diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-21 23:45:49 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-21 23:45:49 (GMT) |
commit | c0463be82447f269d9947d16a40881dbbe600827 (patch) | |
tree | 323dbe19236ee179bea46c9d40af54e2a3403eb3 /src/helsinki.at/rhimportd | |
parent | b917755aab166ebb59ebdb5356114d373ce5cb91 (diff) |
basic session handling works now
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlTelnet.go | 2 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlWebSimple.go | 1 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/main.go | 31 |
3 files changed, 16 insertions, 18 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go index b47d2a1..687652c 100644 --- a/src/helsinki.at/rhimportd/ctrlTelnet.go +++ b/src/helsinki.at/rhimportd/ctrlTelnet.go @@ -198,7 +198,7 @@ func (c *TelnetClient) handle_cmd_set(args []string) { } if c.ctx == nil { c.ctx = rhimport.NewImportContext(c.conf, c.rddb, "") - c.ctx.Trusted = true + c.ctx.Trusted = false } switch strings.ToLower(args[0]) { case "username": diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go index 8ea5ac3..f0e9f29 100644 --- a/src/helsinki.at/rhimportd/ctrlWebSimple.go +++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go @@ -143,6 +143,7 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDbChan, trusted bo } if fres.ResponseCode != http.StatusOK { webSimpleErrorResponse(w, fres.ResponseCode, fres.ErrorString) + return } var ires *rhimport.ImportResult diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index 4b6ddf4..b90df0a 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -26,7 +26,6 @@ package main import ( "flag" - "fmt" "log" "os" "os/signal" @@ -53,31 +52,29 @@ func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) { store := sessions.GetInterface() - ctx := rhimport.NewImportContext(conf, rddb, "hugo") + ctx := rhimport.NewImportContext(conf, rddb, "heslinki") + ctx.Trusted = true + ctx.ShowId = 10002 + ctx.SourceUri = "fake://10" + id, session, err := store.New(ctx) if err != nil { - rhl.Printf("Error SessionStore.New(): %s", err) + rhl.Printf("MAIN: Error SessionStore.New(): %s", err) return } - fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) - + rhl.Printf("MAIN: calling run for heslinki/%s", id) session.Run() - fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) - + rhl.Printf("MAIN: waiting for 2 secondes") time.Sleep(5 * time.Second) - store.Remove("hugo", id) - fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) - - time.Sleep(6 * time.Second) - - fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) - - store.Remove("hugo", id) + rhl.Printf("MAIN: calling remove for heslinki/%s", id) + if err = store.Remove("heslinki", id); err != nil { + rhl.Printf("MAIN: Error SessionStore.Remove(): %s", err) + } - fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) + rhl.Printf("MAIN: remove done") } func main() { @@ -108,7 +105,7 @@ func main() { } defer rddb.Cleanup() - // go session_test(conf, rddb.GetInterface()) + go session_test(conf, rddb.GetInterface()) var wg sync.WaitGroup |