private void Clients_OnClientRemoved(object sender, TcpSocketListener.TcpClientsEventArgs e) { lock (this._receiveBufferLock) { if (this._lockCount > 0) { _pendingRemoveBuffers.Add(e.ReceiveBuffer); } else { _receiveBuffers.Remove(e.ReceiveBuffer); } } }
private void Clients_OnClientAdded(object sender, TcpSocketListener.TcpClientsEventArgs e) { lock (this._receiveBufferLock) { if (this._lockCount > 0) { _pendingAddBuffers.Add(e.ReceiveBuffer); } else { _receiveBuffers.Add(e.ReceiveBuffer); e.ReceiveBuffer.OnWriteComplete = OnBeforeWriteComplete; } } }