/// <summary> /// Finishes the endpoint termination. This will indirectly take care of cleaning the Presence subscription resource as well. /// </summary> private void HandleEndpointTermination(IAsyncResult result) { ApplicationEndpoint endpoint = result.AsyncState as ApplicationEndpoint; endpoint.EndTerminate(result); _matchMaker.UpdateState(MatchMakerState.Terminated); _matchMaker._listOfShutdownAsyncResults.ForEach(ar => ar.SetAsCompleted(null, false)); //Terminate operation never throws this.SetAsCompleted(null, false); }
private void ShutdownEndpoint(AsyncTask task, object state) { if (m_endpoint == null) { task.Complete(null); return; } task.DoOneStep( delegate() { Logger.Log(Logger.LogLevel.Info, "Terminating Application Endpoint."); m_endpoint.BeginTerminate( delegate(IAsyncResult ar) { task.DoFinalStep( delegate() { m_endpoint.EndTerminate(ar); Logger.Log(Logger.LogLevel.Info, "Terminated Application Endpoint."); }); }, null); }); }