public void Stop() { lock (_sessionList) { foreach (DTLSSession session in _sessionList) { session.Stop(); } _sessionList.Clear(); } _udpChannel.Stop(); }
/// <summary> /// Tell the channel to stop processing data and clean itself up. /// </summary> public void Stop() { if (System.Threading.Interlocked.Exchange(ref _running, 0) == 0) { return; } lock (_sessionList) { foreach (DTLSSession session in _sessionList) { session.Stop(); } _sessionList.Clear(); } _udpChannel.Stop(); }