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() {
|
func (pusher *Pusher) ClearPlayer() {
|
||||||
// copy a new map to avoid deadlock
|
// copy a new map to avoid deadlock
|
||||||
players := make(map[string]*Player)
|
|
||||||
pusher.playersLock.Lock()
|
pusher.playersLock.Lock()
|
||||||
for k, v := range pusher.players {
|
players := pusher.players
|
||||||
//v.Stop()
|
|
||||||
players[k] = v
|
|
||||||
}
|
|
||||||
pusher.players = make(map[string]*Player)
|
pusher.players = make(map[string]*Player)
|
||||||
pusher.playersLock.Unlock()
|
pusher.playersLock.Unlock()
|
||||||
go func() { // do not block
|
go func() { // do not block
|
||||||
|
|
Loading…
Reference in New Issue