private void ReleaseManagedResource() { if (disposed) { return; } isServerRunning = false; if (requestQueue != null) { requestQueue.Dispose(); } lock (timerSync) { if (systemTimer != null) { systemTimer.Dispose(); } systemTimer = null; } lock (connections) { foreach (var connection in connections.Values) { connection.Dispose(); } connections.Clear(); } if (listener != null) { listener.Close(); } if (p2pService != null) { p2pService.Dispose(); } disposed = true; }
private void DisposeManagedResources() { _isServerRunning = false; if (_requestQueue != null) { _requestQueue.Dispose(); } lock (_timerSync) { if (_systemTimer != null) { _systemTimer.Dispose(); } _systemTimer = null; } lock (_connections) { foreach (var connection in _connections.Values) { connection.Dispose(); } _connections.Clear(); } if (_listener != null) { _listener.Dispose(); _listener = null; } if (_p2pService != null) { _p2pService.Dispose(); _p2pService = null; } }