summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rhimportd/ctrlTelnet.go14
-rw-r--r--src/rhimportd/ctrlWatchDir.go8
-rw-r--r--src/rhimportd/ctrlWebSimple.go4
-rw-r--r--src/rhimportd/ctrlWebSocket.go10
-rw-r--r--src/rhimportd/routeWeb.go10
-rw-r--r--src/rhimportd/uploadWeb.go2
6 files changed, 24 insertions, 24 deletions
diff --git a/src/rhimportd/ctrlTelnet.go b/src/rhimportd/ctrlTelnet.go
index b6093c9..f57fd7b 100644
--- a/src/rhimportd/ctrlTelnet.go
+++ b/src/rhimportd/ctrlTelnet.go
@@ -34,11 +34,11 @@ import (
"strings"
)
-func telnetQuit(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetQuit(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
return true
}
-func telnetHelp(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetHelp(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
switch len(args) {
case 2:
switch args[1] {
@@ -174,7 +174,7 @@ func telnetSetFilePolicy(c *telgo.Client, param *rhimport.FilePolicy, val string
}
}
-func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
if len(args) != 3 {
c.Sayln("wrong number of arguments")
return false
@@ -226,7 +226,7 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.D
return false
}
-func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -236,7 +236,7 @@ func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb
return false
}
-func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -275,7 +275,7 @@ func telnetProgressCallback(step int, stepName string, current, total float64, t
return true
}
-func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DB) bool {
if c.UserData == nil {
c.Sayln("context is empty please set at least one option")
return false
@@ -325,7 +325,7 @@ func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.D
return false
}
-func StartControlTelnet(addr string, conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan) {
+func StartControlTelnet(addr string, conf *rhimport.Config, db *rddb.DB, sessions *rhimport.SessionStore) {
cmdlist := make(telgo.CmdList)
cmdlist["quit"] = func(c *telgo.Client, args []string) bool { return telnetQuit(c, args, conf, db) }
cmdlist["help"] = func(c *telgo.Client, args []string) bool { return telnetHelp(c, args, conf, db) }
diff --git a/src/rhimportd/ctrlWatchDir.go b/src/rhimportd/ctrlWatchDir.go
index 91b7621..87246a7 100644
--- a/src/rhimportd/ctrlWatchDir.go
+++ b/src/rhimportd/ctrlWatchDir.go
@@ -101,7 +101,7 @@ func watchDirResponse(filename string, result *rhimport.Result) {
watchDirWriteResponse(filename, &watchDirResponseData{result.ResponseCode, result.ErrorString, result.Cart, result.Cut, result.SourceFile})
}
-func watchDirParseRequest(conf *rhimport.Config, db *rddb.DBChan, req *os.File) (ctx *rhimport.Context, err error) {
+func watchDirParseRequest(conf *rhimport.Config, db *rddb.DB, req *os.File) (ctx *rhimport.Context, err error) {
decoder := json.NewDecoder(req)
reqdata := newWatchDirRequestData(conf)
@@ -132,7 +132,7 @@ func watchDirParseRequest(conf *rhimport.Config, db *rddb.DBChan, req *os.File)
return
}
-func watchDirHandler(conf *rhimport.Config, db *rddb.DBChan, ctx *rhimport.Context, filename string) {
+func watchDirHandler(conf *rhimport.Config, db *rddb.DB, ctx *rhimport.Context, filename string) {
rhdl.Printf("WatchDirHandler: request for '%s'", filename)
var err error
@@ -169,7 +169,7 @@ func watchDirHandler(conf *rhimport.Config, db *rddb.DBChan, ctx *rhimport.Conte
return
}
-func watchDirRun(dirname string, conf *rhimport.Config, db *rddb.DBChan) bool {
+func watchDirRun(dirname string, conf *rhimport.Config, db *rddb.DB) bool {
dir, err := os.Open(dirname)
if err != nil {
rhl.Printf("watch-dir-ctrl: %s", err)
@@ -216,7 +216,7 @@ func watchDirRun(dirname string, conf *rhimport.Config, db *rddb.DBChan) bool {
return true
}
-func StartWatchDir(dirname string, conf *rhimport.Config, db *rddb.DBChan) {
+func StartWatchDir(dirname string, conf *rhimport.Config, db *rddb.DB) {
for {
rhl.Printf("watch-dir-ctrl: watching for files in %s", dirname)
t := time.NewTicker(1 * time.Second)
diff --git a/src/rhimportd/ctrlWebSimple.go b/src/rhimportd/ctrlWebSimple.go
index 8cc2ed0..f5d5225 100644
--- a/src/rhimportd/ctrlWebSimple.go
+++ b/src/rhimportd/ctrlWebSimple.go
@@ -91,7 +91,7 @@ func webSimpleResponse(w http.ResponseWriter, result *rhimport.Result) {
encoder.Encode(respdata)
}
-func webSimpleParseRequest(conf *rhimport.Config, db *rddb.DBChan, trusted bool, r *http.Request) (ctx *rhimport.Context, err error) {
+func webSimpleParseRequest(conf *rhimport.Config, db *rddb.DB, trusted bool, r *http.Request) (ctx *rhimport.Context, err error) {
decoder := json.NewDecoder(r.Body)
reqdata := newWebSimpleRequestData(conf)
if jsonerr := decoder.Decode(reqdata); jsonerr != nil {
@@ -122,7 +122,7 @@ func webSimpleParseRequest(conf *rhimport.Config, db *rddb.DBChan, trusted bool,
return
}
-func webSimpleHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan, trusted bool, w http.ResponseWriter, r *http.Request) {
+func webSimpleHandler(conf *rhimport.Config, db *rddb.DB, sessions *rhimport.SessionStore, trusted bool, w http.ResponseWriter, r *http.Request) {
rhdl.Printf("WebSimpleHandler: %s requests '%s'", r.RemoteAddr, html.EscapeString(r.URL.Path))
var ctx *rhimport.Context
diff --git a/src/rhimportd/ctrlWebSocket.go b/src/rhimportd/ctrlWebSocket.go
index 74b88e3..f6b84da 100644
--- a/src/rhimportd/ctrlWebSocket.go
+++ b/src/rhimportd/ctrlWebSocket.go
@@ -192,7 +192,7 @@ func sendWebSocketDoneResponse(ws *websocket.Conn, code int, errStr, id, refid s
type webSocketSession struct {
id string
refId string
- session *rhimport.SessionChan
+ session *rhimport.Session
progresschan chan rhimport.ProgressData
donechan chan rhimport.Result
}
@@ -225,7 +225,7 @@ func webSocketDone(res rhimport.Result, userdata interface{}) bool {
return true
}
-func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, conf *rhimport.Config, sessions *rhimport.SessionStoreChan) (int, string) {
+func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, conf *rhimport.Config, sessions *rhimport.SessionStore) (int, string) {
ctx := rhimport.NewContext(conf, nil, getStdLog("sess-%s-std"), getDbgLog("sess-%s-dbg")) // session store will take of db, stdlog and dbglog
ctx.UserName = reqdata.UserName
ctx.Password = reqdata.Password
@@ -259,7 +259,7 @@ func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, con
return http.StatusOK, "SUCCESS"
}
-func (self *webSocketSession) reconnectSession(reqdata *webSocketRequestData, sessions *rhimport.SessionStoreChan) (int, string) {
+func (self *webSocketSession) reconnectSession(reqdata *webSocketRequestData, sessions *rhimport.SessionStore) (int, string) {
s, refId, code, errstring := sessions.Get(reqdata.UserName, reqdata.Id)
if code != http.StatusOK {
return code, errstring
@@ -302,7 +302,7 @@ func webSocketListUpdate(added, removed map[string]string, userdata interface{})
return true
}
-func webSocketSessionHandler(reqchan <-chan webSocketRequestData, ws *websocket.Conn, conf *rhimport.Config, sessions *rhimport.SessionStoreChan) {
+func webSocketSessionHandler(reqchan <-chan webSocketRequestData, ws *websocket.Conn, conf *rhimport.Config, sessions *rhimport.SessionStore) {
defer ws.Close()
closed := make(chan bool, 1)
@@ -376,7 +376,7 @@ func webSocketSessionHandler(reqchan <-chan webSocketRequestData, ws *websocket.
}
}
-func webSocketHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan, trusted bool, w http.ResponseWriter, r *http.Request) {
+func webSocketHandler(conf *rhimport.Config, db *rddb.DB, sessions *rhimport.SessionStore, trusted bool, w http.ResponseWriter, r *http.Request) {
rhdl.Printf("WebSocketHandler: %s requests '%s'", r.RemoteAddr, html.EscapeString(r.URL.Path))
ws, err := websocket.Upgrade(w, r, nil, 64*1024, 64*1024)
diff --git a/src/rhimportd/routeWeb.go b/src/rhimportd/routeWeb.go
index d0582a2..0411239 100644
--- a/src/rhimportd/routeWeb.go
+++ b/src/rhimportd/routeWeb.go
@@ -34,17 +34,17 @@ import (
type webHandler struct {
*rhimport.Config
- *rddb.DBChan
- *rhimport.SessionStoreChan
+ *rddb.DB
+ *rhimport.SessionStore
trusted bool
- H func(*rhimport.Config, *rddb.DBChan, *rhimport.SessionStoreChan, bool, http.ResponseWriter, *http.Request)
+ H func(*rhimport.Config, *rddb.DB, *rhimport.SessionStore, bool, http.ResponseWriter, *http.Request)
}
func (self webHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- self.H(self.Config, self.DBChan, self.SessionStoreChan, self.trusted, w, r)
+ self.H(self.Config, self.DB, self.SessionStore, self.trusted, w, r)
}
-func StartWebRouter(addr, staticDir string, conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan) {
+func StartWebRouter(addr, staticDir string, conf *rhimport.Config, db *rddb.DB, sessions *rhimport.SessionStore) {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))
// http.Handle("/trusted/simple", webHandler{conf, db, sessions, true, webSimpleHandler})
diff --git a/src/rhimportd/uploadWeb.go b/src/rhimportd/uploadWeb.go
index 0b7ab82..9b2250a 100644
--- a/src/rhimportd/uploadWeb.go
+++ b/src/rhimportd/uploadWeb.go
@@ -57,7 +57,7 @@ func webUploadSuccessResponse(w http.ResponseWriter) {
encoder.Encode(respdata)
}
-func webUploadHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan, trusted bool, w http.ResponseWriter, r *http.Request) {
+func webUploadHandler(conf *rhimport.Config, db *rddb.DB, sessions *rhimport.SessionStore, trusted bool, w http.ResponseWriter, r *http.Request) {
rhdl.Printf("WebUploadHandler: %s requests '%s'", r.RemoteAddr, r.URL.String())
if r.Method != "POST" {