public void RemoveConnection(string clientId) { if (_connections.TryRemove(clientId, out IMqttChannel <IPacket> existingConnection)) { _tracer.Info(ServerProperties.ConnectionProvider_RemovingClient(clientId)); existingConnection.Dispose(); } if (_privateClients.Contains(clientId)) { lock ( _lockObject ) { if (_privateClients.Contains(clientId)) { _privateClients.Remove(clientId); } } } }