Example #1
0
        void OnReceiveOpen(Open open)
        {
            Action<Open> openCallback = this.Settings.OnOpenCallback;
            if (openCallback != null)
            {
                openCallback(open);
            }

            this.Negotiate(open);

            StateTransition stateTransition;
            this.TransitState("R:OPEN", StateTransition.ReceiveOpen, out stateTransition);
            if (stateTransition.To == AmqpObjectState.OpenReceived)
            {
                this.SendOpen();
            }

            if (this.isInitiator && this.Settings.IdleTimeOut.Value != uint.MaxValue)
            {
                this.heartBeatInterval = (int)(this.Settings.IdleTimeOut.Value * 3 / 8);
                if (this.heartBeatInterval < 500)
                {
                    this.heartBeatInterval = 500;
                }

                this.heartBeatTimer = new IOThreadTimer(OnHeartBeatTimer, this, false);
                this.heartBeatTimer.Set(this.heartBeatInterval);
                Utils.Trace(TraceLevel.Info, "{0}: enabled heart beat timer ({1}ms)", this, this.heartBeatInterval);
            }

            this.CompleteOpen(stateTransition.From == AmqpObjectState.Start, null);
        }
Example #2
0
 void Negotiate(Open open)
 {
     this.Settings.RemoteHostName = open.HostName;
     this.Settings.ChannelMax = Math.Min(this.Settings.ChannelMax(), open.ChannelMax());
     this.Settings.IdleTimeOut = Math.Min(open.IdleTimeOut(), this.Settings.IdleTimeOut());
     this.FindMutualCapabilites(this.Settings.DesiredCapabilities, open.OfferedCapabilities);
     if (open.MaxFrameSize.HasValue)
     {
         this.Settings.MaxFrameSize = Math.Min(this.Settings.MaxFrameSize.Value, open.MaxFrameSize.Value);
     }
 }
Example #3
0
 void OnConnectionOpen(Open open)
 {
     if (open.HostName == null)
     {
         throw new AmqpException(AmqpError.InvalidField, "open.hostname");
     }
     else if (!this.connectionHandlers.ContainsKey(open.HostName))
     {
         throw new AmqpException(AmqpError.NotFound, SR.AmqpConnectionHandlerNotFound(open.HostName));
     }
 }