diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-30 21:42:59 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-30 21:42:59 (GMT) |
commit | b48b8d760021bd7a887a24c4bbd239f90c2c2f22 (patch) | |
tree | 27c20e906a1dd83734dbdb854fb8863aa0f622c7 /src/helsinki.at/rhimportd/main.go | |
parent | a37f02747e587b25d45de98d175427d4ccb5cdf7 (diff) |
web socket handler is now completed
Diffstat (limited to 'src/helsinki.at/rhimportd/main.go')
-rw-r--r-- | src/helsinki.at/rhimportd/main.go | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index 87fa3ab..21c1246 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -26,14 +26,11 @@ package main import ( "flag" - // "fmt" "helsinki.at/rhimport" "log" - // "net/http" "os" "os/signal" "sync" - // "time" // "io/ioutil" ) @@ -43,99 +40,6 @@ var ( //rhdl = log.New(ioutil.Discard, "[rhimportd-dbg]\t", log.LstdFlags) ) -// func session_test_progress1(step int, step_name string, progress float64, userdata interface{}) bool { -// out := userdata.(chan<- string) -// select { -// case out <- fmt.Sprintf("CB1 %d, %s: %3.2f%%", step, step_name, progress*100): -// default: -// } -// if step > 1 { -// return false -// } -// return true -// } - -// func session_test_progress2(step int, step_name string, progress float64, userdata interface{}) bool { -// out := userdata.(chan<- string) -// select { -// case out <- fmt.Sprintf("CB2 %d, %s: %3.2f%%", step, step_name, progress*100): -// default: -// } -// return true -// } - -// func session_test_done(res rhimport.ImportResult, userdata interface{}) bool { -// done := userdata.(chan<- rhimport.ImportResult) -// done <- res -// return true -// } - -// func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) { -// sessions, err := rhimport.NewSessionStore(conf) -// if err != nil { -// rhl.Println("Error initializing Session Store:", err) -// return -// } -// defer sessions.Cleanup() - -// store := sessions.GetInterface() - -// ctx := rhimport.NewImportContext(conf, rddb, "heslinki") -// ctx.Trusted = true -// ctx.ShowId = 10002 -// ctx.ClearShowCarts = true -// ctx.SourceUri = "http://www.tonycuffe.com/mp3/tail%20toddle.mp3" - -// id, _, code, errstring := store.New(ctx) -// if code != http.StatusOK { -// rhl.Printf("MAIN: Error SessionStore.New(): %s", errstring) -// return -// } - -// var session *rhimport.SessionChan -// if session, code, errstring = store.Get(ctx.UserName, id); code != http.StatusOK { -// rhl.Printf("MAIN: Error SessionStore.Get(): %s", errstring) -// return -// } - -// dch := make(chan rhimport.ImportResult, 1) -// if err = session.AddDoneHandler((chan<- rhimport.ImportResult)(dch), session_test_done); err != nil { -// rhl.Printf("MAIN: Error Session.AddDoneHandler(): %s", err) -// return -// } - -// pch := make(chan string, 10) -// if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress1); err != nil { -// rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err) -// } -// go func() { -// time.Sleep(3 * time.Second) -// if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress2); err != nil { -// rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err) -// } -// }() - -// rhl.Printf("MAIN: calling run for %s/%s", ctx.UserName, id) -// session.Run(30 * time.Second) - -// for { -// select { -// case p := <-pch: -// fmt.Println(p) -// case r := <-dch: -// fmt.Printf("Import finished: %+v\n", r) -// break -// } -// } - -// rhl.Printf("MAIN: calling remove for %s/%s", ctx.UserName, id) -// if code, errstring = store.Remove(ctx.UserName, id); code != http.StatusOK { -// rhl.Printf("MAIN: Error SessionStore.Remove(): %s", errstring) -// } - -// rhl.Printf("MAIN: remove done") -// } - func main() { web_addr_s := flag.String("web-addr", ":4080", "addr:port to listen on") telnet_addr_s := flag.String("telnet-addr", ":4023", "addr:port to listen on") @@ -164,7 +68,7 @@ func main() { } defer rddb.Cleanup() - sessions, err := rhimport.NewSessionStore(conf) + sessions, err := rhimport.NewSessionStore(conf, rddb.GetInterface()) if err != nil { rhl.Println("Error initializing Session Store:", err) return |