mirror of https://github.com/EasyDarwin/EasyDarwin
代码优化
parent
ad9a22c0b2
commit
785f293376
|
@ -354,12 +354,8 @@ func (pusher *Pusher) RemovePlayer(player *Player) *Pusher {
|
|||
|
||||
func (pusher *Pusher) ClearPlayer() {
|
||||
// copy a new map to avoid deadlock
|
||||
players := make(map[string]*Player)
|
||||
pusher.playersLock.Lock()
|
||||
for k, v := range pusher.players {
|
||||
//v.Stop()
|
||||
players[k] = v
|
||||
}
|
||||
players := pusher.players
|
||||
pusher.players = make(map[string]*Player)
|
||||
pusher.playersLock.Unlock()
|
||||
go func() { // do not block
|
||||
|
|
Loading…
Reference in New Issue