void OnOpen()

in src/Connection.cs [593:641]


        void OnOpen(Open open)
        {
            IHandler handler = this.Handler;
            if (handler != null && handler.CanHandle(EventId.ConnectionRemoteOpen))
            {
                handler.Handle(Event.Create(EventId.ConnectionRemoteOpen, this, context: open));
            }

            lock (this.ThisLock)
            {
                if (this.state == ConnectionState.OpenSent)
                {
                    this.state = ConnectionState.Opened;
                }
                else if (this.state == ConnectionState.ClosePipe)
                {
                    this.state = ConnectionState.CloseSent;
                }
                else
                {
                    throw new AmqpException(ErrorCode.IllegalState,
                        Fx.Format(SRAmqp.AmqpIllegalOperationState, "OnOpen", this.state));
                }
            }

            if (this.onOpened != null)
            {
                this.onOpened(this, open);
                this.onOpened = null;
            }

            if (open.ChannelMax < this.channelMax)
            {
                this.channelMax = open.ChannelMax;
            }

            this.RemoteContainerId = open.ContainerId;
            this.remoteMaxFrameSize = open.MaxFrameSize;
            uint idleTimeout = open.IdleTimeOut;
            if (idleTimeout > 0 && this.heartBeat == null)
            {
                this.heartBeat = new HeartBeat(this, 0);
            }

            if (this.heartBeat != null)
            {
                this.heartBeat.Start(idleTimeout);
            }
        }