Пример #1
0
        public static AmqpSessionSettings Create(Begin begin)
        {
            AmqpSessionSettings settings = new AmqpSessionSettings();
            settings.IncomingWindow = begin.OutgoingWindow;
            settings.OutgoingWindow = begin.IncomingWindow;
            settings.HandleMax = Math.Min(settings.HandleMax.Value, begin.HandleMax());

            return settings;
        }
Пример #2
0
 public void OnBegin(Begin begin)
 {
     lock (this.SyncRoot)
     {
         if (begin.IncomingWindow.Value == uint.MaxValue)
         {
             this.outgoingWindow = this.remoteIncomingWindow = uint.MaxValue;
         }
         else
         {
             // Can happen in pipeline mode
             uint alreadySent = this.Session.settings.OutgoingWindow.Value - this.outgoingWindow;
             if (alreadySent > begin.IncomingWindow.Value)
             {
                 this.remoteIncomingWindow = 0;
                 this.outgoingWindow = 0;
             }
             else
             {
                 this.remoteIncomingWindow = begin.IncomingWindow.Value - alreadySent;
                 this.outgoingWindow = this.remoteIncomingWindow;
             }
         }
     }
 }
Пример #3
0
        void OnReceiveBegin(Begin begin)
        {
            StateTransition stateTransition;
            this.TransitState("R:BEGIN", StateTransition.ReceiveOpen, out stateTransition);

            this.incomingChannel.OnBegin(begin);
            if (stateTransition.To == AmqpObjectState.OpenReceived)
            {
                this.Open();
            }
            else
            {
                Exception exception = null;
                Error error = this.Negotiate(begin);
                if (error != null)
                {
                    exception = new AmqpException(error);
                }

                this.CompleteOpen(false, exception);
                if (exception != null)
                {
                    this.TryClose(exception);
                }
            }
        }
Пример #4
0
        Error Negotiate(Begin begin)
        {
            this.outgoingChannel.OnBegin(begin);
            if (begin.HandleMax.HasValue)
            {
                this.settings.HandleMax = Math.Min(this.settings.HandleMax.Value, begin.HandleMax.Value);
            }

            return null;
        }
Пример #5
0
 public void OnBegin(Begin begin)
 {
     lock (this.SyncRoot)
     {
         this.nextIncomingId = begin.NextOutgoingId.Value;
     }
 }