pause if no clients are connected
This commit is contained in:
parent
0b1e623357
commit
0314ceae4a
|
@ -81,6 +81,7 @@ func serveClients() {
|
||||||
level = data.LoadLevel(LevelFile)
|
level = data.LoadLevel(LevelFile)
|
||||||
frameCounter = 0
|
frameCounter = 0
|
||||||
for { // while true
|
for { // while true
|
||||||
|
if len(clients) > 0 { // pause if no clients are connected
|
||||||
for _, k := range clientKeys {
|
for _, k := range clientKeys {
|
||||||
id, client := k, clients[k]
|
id, client := k, clients[k]
|
||||||
if id > 0 {
|
if id > 0 {
|
||||||
|
@ -105,6 +106,7 @@ func serveClients() {
|
||||||
frameCounter++
|
frameCounter++
|
||||||
time.Sleep(time.Second / time.Duration(level.FPS))
|
time.Sleep(time.Second / time.Duration(level.FPS))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runServer(cmd *cobra.Command, args []string) {
|
func runServer(cmd *cobra.Command, args []string) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user