summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/main.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-20 04:46:01 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-20 04:46:01 (GMT)
commit75dd88f110c117b7fc73b83b13efd2385347f1b9 (patch)
treea0f17c7d8a60b98f894c3222824ee3cd92fe85ae /src/helsinki.at/rhimportd/main.go
parent8fc2a9c93d566feae576c1421b3c64dabc4b4976 (diff)
session store and session kind of work now
still a lot to be done and a lot of testing is needed!
Diffstat (limited to 'src/helsinki.at/rhimportd/main.go')
-rw-r--r--src/helsinki.at/rhimportd/main.go57
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() {