Create a new server if there are no servers

This commit is contained in:
Benjamin Jemlich 2011-04-13 18:51:24 +08:00 committed by Mikkel Krautz
parent 3c5c71288d
commit f273b7d328

View file

@ -173,6 +173,16 @@ func main() {
}
}
if len(servers) == 0 {
s, err := NewServer(1, *host, *port)
if err != nil {
log.Fatalf("Couldn't start server: %s", err.String())
}
servers[s.Id] = s
go s.ListenAndMurmur()
}
if len(servers) > 0 {
ticker := time.NewTicker(10e9) // 10 secs
for {