Example #1
0
        void HandleReceiveRequestComplete(IAsyncResult innerResult, bool completedSynchronously)
        {
            MultipleReceiveAsyncResult receiveResult = this.outstanding;
            Exception completionException            = null;

            try
            {
                Fx.AssertAndThrow(receiveResult != null, "HandleReceive invoked without an outstanding result");
                // Cleanup states
                this.outstanding = null;

                // set the context on the outer result for the ChannelHandler.
                RequestContext context;
                receiveResult.Valid          = this.channelBinder.EndTryReceive(innerResult, out context);
                receiveResult.RequestContext = context;
            }
            catch (Exception ex)
            {
                if (Fx.IsFatal(ex))
                {
                    throw;
                }

                completionException = ex;
            }

            receiveResult.Complete(completedSynchronously, completionException);
        }
        private void HandleReceiveRequestComplete(IAsyncResult innerResult, bool completedSynchronously)
        {
            MultipleReceiveAsyncResult outstanding = this.outstanding;
            Exception completionException          = null;

            try
            {
                RequestContext context;
                Fx.AssertAndThrow(outstanding != null, "HandleReceive invoked without an outstanding result");
                this.outstanding           = null;
                outstanding.Valid          = this.channelBinder.EndTryReceive(innerResult, out context);
                outstanding.RequestContext = context;
            }
            catch (Exception exception2)
            {
                if (Fx.IsFatal(exception2))
                {
                    throw;
                }
                completionException = exception2;
            }
            outstanding.Complete(completedSynchronously, completionException);
        }