public void OnConnectionClosed(ITcpConnection connection, SocketError socketError) { var operateID = Guid.NewGuid().ToString(); var lockkey = connection.RemotingEndPoint.ToString(); if (_lock.LockTake(lockkey, operateID, TimeSpan.FromSeconds(10))) { _clientPool.ConnectedClientList.Remove(_client); _clientPool.CurrentCount -= 1; _clientPool.InstallPool(); _lock.LockRelease(lockkey, operateID); } else { OnConnectionClosed(connection, socketError); } }
public void OnConnectionFailed(EndPoint remotingEndPoint, SocketError socketError) { Interlocked.Decrement(ref _clientPool.PrepareCreateCount); _clientPool.InstallPool(); }