Esempio n. 1
0
		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." );
					}
				}
			}
		}
Esempio n. 2
0
			public AsynchronousConnectHandler( RpcSocketAsyncEventArgs context, RpcSocket socketToConnect )
			{
				this._context = context;
				this._socketToConnect = socketToConnect;
			}
Esempio n. 3
0
		public void Return( RpcSocketAsyncEventArgs context )
		{
			this.Return( context, false );
		}