summaryrefslogtreecommitdiff
path: root/src/hub
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srv.go13
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvConf.go1
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5typesStore.go2
3 files changed, 12 insertions, 4 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srv.go b/src/hub/src/spreadspace.org/sfive/s5srv.go
index 2a312bd..adfd2da 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srv.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srv.go
@@ -140,6 +140,11 @@ func (srv Server) Close() {
s5l.Printf("srv: shutting down")
close(srv.quit)
srv.done.Wait()
+ // TODO: shutdown procedure is flawed:
+ // - there might still be data in the ingest and ingestMany channels
+ // when issuing quit -> data loss!!
+ // - if interfaces ingets new data when ingest channels are alreday closed
+ // they produce a panic!!
close(srv.ingestChan)
close(srv.ingestManyChan)
@@ -148,7 +153,6 @@ func (srv Server) Close() {
}
func NewServer(cfg SrvConfig) (srv *Server, err error) {
- // TODO: read configuration and create instance with correct settings
srv = &Server{}
if srv.store, err = NewStore(cfg.Store); err != nil {
return
@@ -170,7 +174,10 @@ func NewServer(cfg SrvConfig) (srv *Server, err error) {
s5l.Printf("srv|xfrm: using Geo-IP Lookup: %s", srv.geoip)
}
- srv.numWorker = runtime.NumCPU() // TODO: make this configurable
+ srv.numWorker = runtime.NumCPU()
+ if cfg.Workers > 0 {
+ srv.numWorker = cfg.Workers
+ }
srv.quit = make(chan bool)
srv.done = &sync.WaitGroup{}
srv.ingestChan = make(chan ingestToken, srv.numWorker)
@@ -182,6 +189,6 @@ func NewServer(cfg SrvConfig) (srv *Server, err error) {
srv.ingestWorker(idx)
}(i)
}
- s5l.Printf("srv: started")
+ s5l.Printf("srv: started with %d worker", srv.numWorker)
return
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvConf.go b/src/hub/src/spreadspace.org/sfive/s5srvConf.go
index c4a6158..5718cec 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvConf.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvConf.go
@@ -93,6 +93,7 @@ type ForwardsConfig struct {
type SrvConfig struct {
Interfaces InterfacesConfig `json:"interfaces" yaml:"interfaces" toml:"interfaces"`
+ Workers int `json:"workers" yaml:"workers" toml:"workers"`
Transform TransformConfig `json:"transform" yaml:"transform" toml:"transform"`
Store StoreConfig `json:"store" yaml:"store" toml:"store"`
Forwards ForwardsConfig `json:"forwards" yaml:"forwards" toml:"forwards"`
diff --git a/src/hub/src/spreadspace.org/sfive/s5typesStore.go b/src/hub/src/spreadspace.org/sfive/s5typesStore.go
index 9e154c8..680973a 100644
--- a/src/hub/src/spreadspace.org/sfive/s5typesStore.go
+++ b/src/hub/src/spreadspace.org/sfive/s5typesStore.go
@@ -130,7 +130,7 @@ func NewClientDB(c *Client) *clientDB {
}
}
-func (c *clientDB) Slug() string { // TODO: use better seperator between IP:Port, : might not be unique if IP is an IPv6 address
+func (c *clientDB) Slug() string { // TODO: use better seperator between IP:Port, : might not be unique if IP is an IPv6 address???
return fmt.Sprintf("%s:%d/%s/%s/%s/%f,%f", c.IP, c.Port, c.CountryCode2, c.RegionCode, c.CityName, c.Latitude, c.Longitude)
}