void IStage.Leave() { _WriterStop(); _ReaderStop(); if (_Peer != null) { _Peer.Close(); _Peer = null; } _Core.Finial(); Singleton <Log> .Instance.WriteInfo("Agent online leave."); }
void IBootable.Shutdown() { try { _Peer.Close(); } catch (System.Net.Sockets.SocketException se) { Regulus.Utility.Log.Instance.WriteInfo(string.Format("Socket shutdown peer exception.{0}", se.Message)); } catch (Exception e) { Regulus.Utility.Log.Instance.WriteInfo(string.Format("Socket shutdown exception.{0}", e.Message)); } _Reader.DoneEvent -= _RequestPush; _Reader.Stop(); _Writer.Stop(); System.Threading.Interlocked.Add(ref _TotalResponse, -_Responses.Count); System.Threading.Interlocked.Add(ref _TotalRequest, -_Requests.Count); }