safer close
This commit is contained in:
parent
afc125cc1c
commit
6002e20080
@ -47,9 +47,11 @@ func (m *Manager) Run() {
|
|||||||
m.Connections[connection.ID] = connection
|
m.Connections[connection.ID] = connection
|
||||||
m.logger.Tracef("connection '%s' registered", connection.ID)
|
m.logger.Tracef("connection '%s' registered", connection.ID)
|
||||||
case connection := <-m.delConnection:
|
case connection := <-m.delConnection:
|
||||||
|
if !connection.closed {
|
||||||
connection.Close()
|
connection.Close()
|
||||||
delete(m.Connections, connection.ID)
|
delete(m.Connections, connection.ID)
|
||||||
m.logger.Tracef("connection '%s' unregistered", connection.ID)
|
m.logger.Tracef("connection '%s' unregistered", connection.ID)
|
||||||
|
}
|
||||||
case onReceiveQueue <- true:
|
case onReceiveQueue <- true:
|
||||||
go m.onReceive(onReceiveQueue)
|
go m.onReceive(onReceiveQueue)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user