public void Dispose() { if (AsyncConsumer != null) { AsyncConsumer.Push(null); AsyncConsumer.Dispose(); AsyncConsumer = null; } }
public void Stop() { IsRunningValue.Update ( b => { if (!b) { return(false); } if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource.Cancel(); } if (ListenConsumer != null) { Listener.Stop(); ListenConsumer.Dispose(); Listener.Close(); Listener = null; ListenConsumer = null; } if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource = null; } if (AcceptConsumer != null) { AcceptConsumer.Dispose(); AcceptConsumer = null; } if (ContextPurifyConsumer != null) { ContextPurifyConsumer.Dispose(); ContextPurifyConsumer = null; } return(false); } ); }
public void Stop() { IsRunningValue.Update ( b => { if (!b) { return(false); } if (LastActiveTimeCheckTimer != null) { LastActiveTimeCheckTimer.Dispose(); LastActiveTimeCheckTimer = null; } if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource.Cancel(); } foreach (var BindingInfo in BindingInfos) { BindingInfo.Socket.DoAction ( Socket => { try { Socket.Dispose(); } catch (Exception) { } } ); } foreach (var BindingInfo in BindingInfos) { BindingInfo.ListenConsumer.Dispose(); } BindingInfos.Clear(); if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource = null; } if (AcceptConsumer != null) { AcceptConsumer.Dispose(); AcceptConsumer = null; } List <UdpSession> Sessions = null; SessionSets.DoAction ( ss => { Sessions = ss.Sessions.ToList(); ss.Sessions.Clear(); ss.IpSessions.Clear(); ss.SessionIdToSession.Clear(); } ); foreach (var s in Sessions) { s.Dispose(); } if (PurifyConsumer != null) { PurifyConsumer.Dispose(); PurifyConsumer = null; } return(false); } ); }
public void Stop() { IsRunningValue.Update ( b => { if (!b) { return(false); } if (LastActiveTimeCheckTimer != null) { LastActiveTimeCheckTimer.Dispose(); LastActiveTimeCheckTimer = null; } if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource.Cancel(); } if (ListenConsumer != null) { Listener.Stop(); ListenConsumer.Dispose(); Listener.Close(); Listener = null; ListenConsumer = null; } if (ListeningTaskTokenSource != null) { ListeningTaskTokenSource = null; } if (AcceptConsumer != null) { AcceptConsumer.Dispose(); AcceptConsumer = null; } List <HttpSession> Sessions = null; SessionSets.DoAction ( ss => { Sessions = ss.Sessions.ToList(); ss.Sessions.Clear(); ss.IpSessions.Clear(); } ); foreach (var s in Sessions) { s.Dispose(); } if (ContextPurifyConsumer != null) { ContextPurifyConsumer.Dispose(); ContextPurifyConsumer = null; } if (PurifyConsumer != null) { PurifyConsumer.Dispose(); PurifyConsumer = null; } return(false); } ); }