Microsoft.Azure.Amqp.DuplexAmqpLink.OnOperationComplete C# (CSharp) Method

OnOperationComplete() private method

private OnOperationComplete ( AmqpObject link, IAsyncResult result, bool isOpen ) : void
link AmqpObject
result IAsyncResult
isOpen bool
return void
        void OnOperationComplete(AmqpObject link, IAsyncResult result, bool isOpen)
        {
            Exception completeException = null;
            try
            {
                if (isOpen)
                {
                    link.EndOpen(result);
                }
                else
                {
                    link.EndClose(result);
                }
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }

                completeException = exception;
            }

            bool shouldComplete = true;
            if (completeException == null)
            {
                AmqpObjectState initialState = isOpen ? AmqpObjectState.OpenSent : AmqpObjectState.CloseSent;
                lock (this.ThisLock)
                {
                    shouldComplete = this.sender.State != initialState && this.receiver.State != initialState;
                }
            }

            if (shouldComplete)
            {
                if (isOpen)
                {
                    this.CompleteOpen(false, completeException);
                }
                else
                {
                    this.CompleteClose(false, completeException);
                }
            }
        }
    }

Usage Example

Example #1
0
        static void OnReceiverClose(IAsyncResult result)
        {
            DuplexAmqpLink thisPtr = (DuplexAmqpLink)result.AsyncState;

            thisPtr.OnOperationComplete(thisPtr.receiver, result, false);
        }
All Usage Examples Of Microsoft.Azure.Amqp.DuplexAmqpLink::OnOperationComplete