private void Return( RpcSocketAsyncEventArgs context, bool isInFinalizer ) { if ( context == null ) { throw new ArgumentNullException( "context" ); } if ( !this._statusTable.ContainsKey( context ) ) { throw new ArgumentException( "Specified socket does not belong to this pool.", "context" ); } Contract.EndContractBlock(); // FIXME: Shrink buffer in context. try { } finally { if ( this._statusTable.TryUpdate( context, LeaseStatus.Ready, LeaseStatus.InUse ) ) { this._availableSockets.Add( context ); } else { if ( !isInFinalizer ) { throw new InvalidOperationException( "ConectionPool is in inconsistent state. Returning socket is not in use." ); } } } }
public AsynchronousConnectHandler( RpcSocketAsyncEventArgs context, RpcSocket socketToConnect ) { this._context = context; this._socketToConnect = socketToConnect; }
public void Return( RpcSocketAsyncEventArgs context ) { this.Return( context, false ); }