/// <summary> /// 停止服务 /// </summary> public override void Dispose() { if (Interlocked.CompareExchange(ref IsDisposed, 1, 0) == 0) { if (isListen != 0) { isListen = 0; if (Log.IsAnyType(AutoCSer.Log.LogType.Info)) { Log.Add(AutoCSer.Log.LogType.Info, "停止服务 " + Attribute.ServerName + " " + IpAddress.ToString() + "[" + Attribute.Host + "]:" + Port.toString()); } AutoCSer.DomainUnload.Unloader.Remove(this, DomainUnload.Type.TcpCommandBaseDispose, false); StopListen(); } if (CallQueueArray != null) { foreach (KeyValue <ServerCallCanDisposableQueue, ServerCallCanDisposableQueue.LowPriorityLink> callQueue in CallQueueArray) { callQueue.Key.Dispose(); } } else if (CallQueue != null) { CallQueue.Dispose(); } } }
/// <summary> /// 停止服务 /// </summary> public override void Dispose() { if (Interlocked.CompareExchange(ref IsDisposed, 1, 0) == 0 && isListen != 0) { isListen = 0; if (Log.IsAnyType(AutoCSer.Log.LogType.Info)) { Log.Add(AutoCSer.Log.LogType.Info, "停止服务 " + ServerName + " " + IpAddress.ToString() + "[" + Attribute.Host + "]:" + Port.toString()); } AutoCSer.DomainUnload.Unloader.Remove(this, DomainUnload.Type.TcpCommandBaseDispose, false); StopListen(); if (CallQueue != null) { CallQueue.Dispose(); CallQueue = null; } } }