diff options
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r-- | src/helsinki.at/rhimportd/main.go | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index d599cd5..51a406e 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -26,10 +26,12 @@ package main import ( "flag" + "fmt" "log" "os" "os/signal" "sync" + "time" "helsinki.at/rhimport" // "io/ioutil" @@ -42,8 +44,8 @@ var ( ) 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") + // 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") rdconf_s := flag.String("rdconf", "/etc/rd.conf", "path to the Rivendell config file") rdxport_url_s := flag.String("rdxport-url", "http://localhost/rd-bin/rdxport.cgi", "the url to the Rivendell web-api") temp_dir_s := flag.String("tmp-dir", os.TempDir(), "path to temporary files") @@ -76,23 +78,54 @@ func main() { } defer sessions.Cleanup() + store := sessions.GetInterface() + + ctx := rhimport.NewImportContext(conf, rddb.GetInterface(), "hugo") + id, session, err := store.New(ctx) + if err != nil { + rhl.Printf("Error SessionStore.New(): %s", err) + return + } + + fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) + + session.Run() + + fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) + + time.Sleep(12 * time.Second) + + fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) + + store.Remove("hugo", id) + + fmt.Printf("\n\nSESSION_STORE: %+v\n\n", sessions) + var wg sync.WaitGroup wg.Add(1) go func() { defer wg.Done() - rhl.Println("starting web-ctrl") - StartControlWeb(*web_addr_s, conf, rddb.GetChannels()) - rhl.Println("web-ctrl finished") + for { + time.Sleep(10 * time.Second) + } }() - wg.Add(1) - go func() { - defer wg.Done() - rhl.Println("starting telnet-ctrl") - StartControlTelnet(*telnet_addr_s, conf, rddb.GetChannels()) - rhl.Println("telnet-ctrl finished") - }() + // wg.Add(1) + // go func() { + // defer wg.Done() + // rhl.Println("starting web-ctrl") + // StartControlWeb(*web_addr_s, conf, rddb.GetInterface()) + // rhl.Println("web-ctrl finished") + // }() + + // wg.Add(1) + // go func() { + // defer wg.Done() + // rhl.Println("starting telnet-ctrl") + // StartControlTelnet(*telnet_addr_s, conf, rddb.GetInterface()) + // rhl.Println("telnet-ctrl finished") + // }() alldone := make(chan bool) go func() { |