Exemplo n.º 1
0
        static void OnSafeCloseComplete(IAsyncResult result)
        {
            AmqpObject thisPtr = (AmqpObject)result.AsyncState;

            try
            {
                thisPtr.EndClose(result);
            }
            catch (Exception exception) when(!Fx.IsFatal(exception))
            {
                AmqpTrace.Provider.AmqpLogError(thisPtr, "SafeCloseComplete", exception.ToStringSlim());

                thisPtr.Abort();
            }
        }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 3
0
 public CloseAsyncResult(AmqpObject amqpObject, TimeSpan timeout, AsyncCallback callback, object asyncState)
     : base(amqpObject, timeout, callback, asyncState)
 {
     amqpObject.pendingClose = this;
     this.Start();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Called when an IoEvent occurrs.
 /// </summary>
 /// <param name="source">The object that sends the event.</param>
 /// <param name="ioEvent">The event.</param>
 /// <param name="queueSize">The size that the source maintains for such events.</param>
 public virtual void AmqpIoEvent(AmqpObject source, IoEvent ioEvent, long queueSize)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Called when an AmqpObject state is changed.
 /// </summary>
 /// <param name="source">The object.</param>
 /// <param name="operation">The operation that triggers the change.</param>
 /// <param name="fromState">The previous state.</param>
 /// <param name="toState">The current state.</param>
 public virtual void AmqpStateTransition(AmqpObject source, string operation, AmqpObjectState fromState, AmqpObjectState toState)
 {
 }