Skip to content

Commit

Permalink
Bugfix: Don't wait on the unregister channel to avoid dipose() race c…
Browse files Browse the repository at this point in the history
…ondition
  • Loading branch information
knadh committed Nov 19, 2016
1 parent 27666fb commit 10c6b17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conn.go
Expand Up @@ -272,7 +272,10 @@ func (room *Room) setExpiry(seconds int) {
func (peer *Peer) listen() {
defer func() {
if _, exists := rooms[peer.room_id]; exists {
rooms[peer.room_id].unregister <- peer
select {
case rooms[peer.room_id].unregister <- peer:
default:
}
}
peer.ws.Close()
}()
Expand Down

0 comments on commit 10c6b17

Please sign in to comment.