/// <summary> /// 获取客户端请求 /// </summary> internal void GetSocket() { ReceiveVerifyCommandTimeout = new SocketTimeoutLink(ServerAttribute.ReceiveVerifyCommandSeconds > 0 ? ServerAttribute.ReceiveVerifyCommandSeconds : TcpInternalServer.ServerAttribute.DefaultReceiveVerifyCommandSeconds); try { if (verify == null) { getSocket(); } else { getSocketVerify(); } } finally { SocketTimeoutLink.Free(ref ReceiveVerifyCommandTimeout); } }
/// <summary> /// 获取客户端请求 /// </summary> internal void GetSocket() { //ThreadPriority priority = Thread.CurrentThread.Priority; ReceiveVerifyCommandTimeout = new SocketTimeoutLink(ServerAttribute.ReceiveVerifyCommandSeconds > 0 ? ServerAttribute.ReceiveVerifyCommandSeconds : TcpOpenServer.ServerAttribute.DefaultReceiveVerifyCommandSeconds); try { socketHandle.Set(0); AutoCSer.Threading.ThreadPool.TinyBackground.FastStart(this, AutoCSer.Threading.ThreadTaskType.TcpOpenServerOnSocket); //Thread.CurrentThread.Priority = ThreadPriority.Highest; if (verify == null) { getSocket(); } else { getSocketVerify(); } //Thread.CurrentThread.Priority = priority; socketHandle.Set(); } finally { SocketTimeoutLink.Free(ref ReceiveVerifyCommandTimeout); } }
/// <summary> /// 释放资源 /// </summary> public void Dispose() { if (isDisposed == 0) { int clientIndex = 0; Uri uri = null; clientLock.EnterYield(); if (isDisposed == 0) { isDisposed = 1; clientIndex = this.clientIndex; this.clientIndex = 0; uri = uris.GetClear(); } clientLock.Exit(); if (clientIndex != 0) { foreach (HttpClient client in clients) { client.Free(); if (--clientIndex == 0) { break; } } } Array.Clear(clients, 0, clients.Length); if (uri != null) { uri.CancelQueue(Log); } SocketTimeoutLink.Free(ref socketTimeout); } }