public void Push(TCPClient tcpClient) { if (!tcpClient.IsConnected()) { lock (this.pool) { this.ErrCount++; } } else { lock (this.pool) { this.pool.Enqueue(tcpClient); } this.semaphoreClients.Release(); } }
/// <summary> /// 压入一个连接 /// </summary> /// <param name="tcpClient"></param> /// <returns></returns> public void Push(TCPClient tcpClient) { //如果是已经无效的连接,则不再放入缓存池 if (!tcpClient.IsConnected()) { lock (this.pool) { ErrCount++; } return; } lock (this.pool) { this.pool.Enqueue(tcpClient); } this.semaphoreClients.Release(); }