Ocean/ICCC/Init.go

30 lines
928 B
Go
Raw Normal View History

package ICCC
import (
"container/list"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
)
2015-06-17 15:44:52 +00:00
// Init this package.
func init() {
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Start init of ICCC.`)
defer Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Done init ICCC.`)
2015-06-17 15:44:52 +00:00
// Create the list as cache for all global listener (not only listener from this server):
cacheListenerDatabase = list.New()
2015-06-17 15:44:52 +00:00
// Create a mapping as cache for all local listener end-points (functions):
listeners = make(map[string]func(data map[string][]string))
// Using the local IP address:
correctAddressWithPort = Tools.LocalIPAddressAndPort()
2015-06-17 15:44:52 +00:00
// Init the database:
initDB()
2015-06-17 15:44:52 +00:00
// Register this server to the listener (if not present):
registerHost2Database()
}