Merge multiple init funcs into one

master
HimbeerserverDE 2021-01-10 22:54:33 +01:00
parent bdf3f7a7fc
commit 96c9201586
4 changed files with 7 additions and 8 deletions

View File

@ -4,10 +4,6 @@ import "encoding/binary"
var aoIDs map[PeerID]map[uint16]bool
func InitAOMap() {
aoIDs = make(map[PeerID]map[uint16]bool)
}
func processAORmAdd(p *Peer, data []byte) []byte {
countRm := binary.BigEndian.Uint16(data[2:4])
aoRm := make([]uint16, countRm)

View File

@ -19,7 +19,7 @@ force_default_server: true
`)
// LoadConfig loads the configuration file
func LoadConfig() error {
func loadConfig() error {
os.Mkdir("config", 0775)
_, err := os.Stat("config/multiserver.yml")

View File

@ -509,3 +509,8 @@ func Init(p, p2 *Peer, ignMedia bool, fin chan struct{}) {
}
}
}
func InitMultiserver() {
aoIDs = make(map[PeerID]map[uint16]bool)
loadConfig()
}

View File

@ -9,9 +9,7 @@ import (
)
func main() {
multiserver.InitAOMap()
multiserver.LoadConfig()
multiserver.InitMultiserver()
multiserver.InitLua()
defer multiserver.CloseLua()