Exemple #1
0
        private void OnReceiveOpen(Open open)
        {
            StateTransition stateTransition = base.TransitState("R:OPEN", StateTransition.ReceiveOpen);

            this.Negotiate(open);
            base.NotifyOpening(open);
            uint num = open.IdleTimeOut();

            if (num < 60000)
            {
                base.CompleteOpen(false, new AmqpException(AmqpError.NotAllowed, SRAmqp.AmqpIdleTimeoutNotSupported(num, (uint)60000)));
                return;
            }
            if (stateTransition.To == AmqpObjectState.OpenReceived)
            {
                this.SendOpen();
            }
            if (this.isInitiator)
            {
                Error error = null;
                if (open.Properties != null && open.Properties.TryGetValue <Error>("com.microsoft:open-error", out error))
                {
                    base.CompleteOpen(stateTransition.From == AmqpObjectState.Start, new AmqpException(error));
                    return;
                }
            }
            if (num != -1)
            {
                this.heartBeatInterval = (int)(num * 7 / 8);
                this.heartBeatTimer    = new IOThreadTimer(new Action <object>(AmqpConnection.OnHeartBeatTimer), this, false);
                this.heartBeatTimer.Set(this.heartBeatInterval);
            }
            base.CompleteOpen(stateTransition.From == AmqpObjectState.Start, null);
        }