diff options
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlTelnet.go | 8 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlWeb.go | 8 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlWebSimple.go | 4 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/main.go | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go index 49971e1..04d90da 100644 --- a/src/helsinki.at/rhimportd/ctrlTelnet.go +++ b/src/helsinki.at/rhimportd/ctrlTelnet.go @@ -43,7 +43,7 @@ type TelnetClient struct { scanner *bufio.Scanner writer *bufio.Writer conf *rhimport.Config - rddb *rhimport.RdDb + rddb *rhimport.RdDbChan ctx *rhimport.ImportContext } @@ -148,7 +148,7 @@ func (c *TelnetClient) handle_cmd_set(args []string) { } if c.ctx == nil { c.ctx = rhimport.NewImportContext(c.conf, c.rddb, "") - c.ctx.Trusted = false + c.ctx.Trusted = true } switch strings.ToLower(args[0]) { case "username": @@ -365,7 +365,7 @@ func (c *TelnetClient) handle() { } } -func newTelnetClient(conn net.Conn, conf *rhimport.Config, rddb *rhimport.RdDb) (c *TelnetClient) { +func newTelnetClient(conn net.Conn, conf *rhimport.Config, rddb *rhimport.RdDbChan) (c *TelnetClient) { rhl.Println("telnet-ctrl: new client from:", conn.RemoteAddr()) c = &TelnetClient{} c.conn = conn @@ -377,7 +377,7 @@ func newTelnetClient(conn net.Conn, conf *rhimport.Config, rddb *rhimport.RdDb) return c } -func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDb) { +func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDbChan) { rhl.Println("telnet-ctrl: listening on", addr_s) server, err := net.Listen("tcp", addr_s) diff --git a/src/helsinki.at/rhimportd/ctrlWeb.go b/src/helsinki.at/rhimportd/ctrlWeb.go index 8aff492..6b6568d 100644 --- a/src/helsinki.at/rhimportd/ctrlWeb.go +++ b/src/helsinki.at/rhimportd/ctrlWeb.go @@ -32,16 +32,16 @@ import ( type webHandler struct { *rhimport.Config - *rhimport.RdDb + *rhimport.RdDbChan trusted bool - H func(*rhimport.Config, *rhimport.RdDb, bool, http.ResponseWriter, *http.Request) + H func(*rhimport.Config, *rhimport.RdDbChan, bool, http.ResponseWriter, *http.Request) } func (self webHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - self.H(self.Config, self.RdDb, self.trusted, w, r) + self.H(self.Config, self.RdDbChan, self.trusted, w, r) } -func StartControlWeb(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDb) { +func StartControlWeb(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDbChan) { http.Handle("/public/simple", webHandler{conf, rddb, false, webSimpleHandler}) http.Handle("/trusted/simple", webHandler{conf, rddb, true, webSimpleHandler}) diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go index da240a8..8ea5ac3 100644 --- a/src/helsinki.at/rhimportd/ctrlWebSimple.go +++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go @@ -91,7 +91,7 @@ func webSimpleResponse(w http.ResponseWriter, result *rhimport.ImportResult) { encoder.Encode(respdata) } -func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool, r *http.Request) (ctx *rhimport.ImportContext, err error) { +func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trusted bool, r *http.Request) (ctx *rhimport.ImportContext, err error) { decoder := json.NewDecoder(r.Body) reqdata := newWebSimpleRequestData(conf) @@ -121,7 +121,7 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted b return } -func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool, w http.ResponseWriter, r *http.Request) { +func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDbChan, trusted bool, w http.ResponseWriter, r *http.Request) { rhdl.Printf("SimpleHandler: request for '%s'", html.EscapeString(r.URL.Path)) var ctx *rhimport.ImportContext diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index b6ac68b..d599cd5 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -82,7 +82,7 @@ func main() { go func() { defer wg.Done() rhl.Println("starting web-ctrl") - StartControlWeb(*web_addr_s, conf, rddb) + StartControlWeb(*web_addr_s, conf, rddb.GetChannels()) rhl.Println("web-ctrl finished") }() @@ -90,7 +90,7 @@ func main() { go func() { defer wg.Done() rhl.Println("starting telnet-ctrl") - StartControlTelnet(*telnet_addr_s, conf, rddb) + StartControlTelnet(*telnet_addr_s, conf, rddb.GetChannels()) rhl.Println("telnet-ctrl finished") }() |