Another try to fix not removing last player.

This commit is contained in:
Sascha L. Teichmann 2022-02-28 21:26:04 +01:00
parent 6ffa0e1001
commit 6fb338dbb8

View File

@ -133,13 +133,17 @@ func samePlayers(a, b []*player) bool {
func (ps *players) run() { func (ps *players) run() {
for { for {
ps.mu.Lock()
empty := len(ps.pls) == 0
ps.mu.Unlock()
pls, err := ps.readFromFIFO() pls, err := ps.readFromFIFO()
if err != nil { if err != nil {
//log.Printf("err: %s\n", err) //log.Printf("err: %s\n", err)
time.Sleep(sleepInterval) time.Sleep(sleepInterval)
continue continue
} }
if pls == nil { if empty && pls == nil {
//log.Println("no players") //log.Println("no players")
continue continue
} }