private void HandleDisconnect() { client?.Close(); server?.Close(); client = null; server = null; Disconnected?.Invoke(this, EventArgs.Empty); }
public void Disconnect() { try { SendDisconnect(); } catch { // ignore } client?.Close(); server?.Close(); client = null; server = null; Disconnected?.Invoke(this, EventArgs.Empty); }
public void Stop() { _logger.Info("Shutting down..."); _remoteServer.Close(); _natServer.Stop(); _natServer2.Stop(); _server.Stop(); _logger.Dispose(); _packetLogger.Dispose(); }
private void HandleDisconnect() { lock (registeredResponseHandlers) { registeredResponseHandlers.Clear(); } lock (registeredHeartbeatHandlers) { registeredHeartbeatHandlers.Clear(); } server?.Close(); client?.Close(); client = null; server = null; Disconnected?.Invoke(this, EventArgs.Empty); serverState = ServerState.Offline; }