Inheritance: Performative
Beispiel #1
0
 void Negotiate(Open open)
 {
     this.Settings.RemoteContainerId = open.ContainerId;
     this.Settings.RemoteHostName = open.HostName;
     this.Settings.ChannelMax = Math.Min(this.Settings.ChannelMax(), open.ChannelMax());
     this.sessionsByLocalHandle.SetMaxHandle(this.Settings.ChannelMax.Value);
     this.sessionsByRemoteHandle.SetMaxHandle(this.Settings.ChannelMax.Value);
     if (this.isInitiator)
     {
         this.FindMutualCapabilites(this.Settings.DesiredCapabilities, open.OfferedCapabilities);
     }
     else
     {
         this.FindMutualCapabilites(this.Settings.OfferedCapabilities, open.DesiredCapabilities);
     }
     
     if (open.MaxFrameSize.HasValue)
     {
         this.Settings.MaxFrameSize = Math.Min(this.Settings.MaxFrameSize.Value, open.MaxFrameSize.Value);
     }
 }
Beispiel #2
0
        void OnReceiveOpen(Open open)
        {
            StateTransition stateTransition = this.TransitState("R:OPEN", StateTransition.ReceiveOpen);

            uint peerIdleTimeout = open.IdleTimeOut();
            if (peerIdleTimeout < this.Settings.MinIdleTimeout)
            {
                this.CompleteOpen(false,
                    new AmqpException(AmqpErrorCode.NotAllowed, AmqpResources.GetString(AmqpResources.AmqpIdleTimeoutNotSupported, peerIdleTimeout, this.Settings.MinIdleTimeout)));
                return;
            }

            this.Negotiate(open);
            this.NotifyOpening(open);

            if (stateTransition.To == AmqpObjectState.OpenReceived)
            {
                this.SendOpen();
            }
            
            if(this.isInitiator)
            {
                // check if open returned an error right away
                Error openError = null;
                if (open.Properties != null && open.Properties.TryGetValue<Error>(AmqpConstants.OpenErrorName, out openError))
                {
                    this.CompleteOpen(stateTransition.From == AmqpObjectState.Start, new AmqpException(openError));
                    return;
                }
            }

            uint myIdleTimeout = this.Settings.IdleTimeOut();
            peerIdleTimeout = open.IdleTimeOut();
            if (peerIdleTimeout != uint.MaxValue || myIdleTimeout != uint.MaxValue)
            {
                this.heartBeat = HeartBeat.Initialize(this, myIdleTimeout, peerIdleTimeout);
            }

            this.CompleteOpen(stateTransition.From == AmqpObjectState.Start, null);
        }