diff --git a/manager.go b/manager.go index 9c149a7..7bd4ef0 100644 --- a/manager.go +++ b/manager.go @@ -47,9 +47,11 @@ func (m *Manager) Run() { m.Connections[connection.ID] = connection m.logger.Tracef("connection '%s' registered", connection.ID) case connection := <-m.delConnection: - connection.Close() - delete(m.Connections, connection.ID) - m.logger.Tracef("connection '%s' unregistered", connection.ID) + if !connection.closed { + connection.Close() + delete(m.Connections, connection.ID) + m.logger.Tracef("connection '%s' unregistered", connection.ID) + } case onReceiveQueue <- true: go m.onReceive(onReceiveQueue) }