internal void Init()

in src/Connection.cs [236:285]


        internal void Init(IBufferManager bufferManager, AmqpSettings amqpSettings, IAsyncTransport transport, Open open)
        {
            transport.SetConnection(this);

            this.BufferManager = bufferManager;
            this.channelMax = GetChannelMax(amqpSettings, open);
            this.maxFrameSize = GetMaxFrameSize(amqpSettings, open);
            this.MaxLinksPerSession = amqpSettings.MaxLinksPerSession;
            this.writer = new TransportWriter(transport, this.OnIoException);

            // after getting the transport, move state to open pipe before starting the pump
            uint idleTimeout = 0;
            if (open == null)
            {
                open = new Open()
                {
                    ContainerId = amqpSettings.ContainerId,
                    HostName = amqpSettings.HostName ?? this.address.Host,
                    ChannelMax = this.channelMax,
                    MaxFrameSize = this.maxFrameSize,
                };

                if (amqpSettings.IdleTimeout != -1)
                {
                    idleTimeout = (uint)amqpSettings.IdleTimeout;
                    open.IdleTimeOut = idleTimeout / 2;
                }
            }
            else if (open.HasField(4))
            {
                idleTimeout = open.IdleTimeOut;
                if (idleTimeout > (uint.MaxValue / 2))
                {
                    idleTimeout = uint.MaxValue;
                }
                else
                {
                    idleTimeout *= 2;
                }
            }

            if (idleTimeout > 0)
            {
                this.heartBeat = new HeartBeat(this, idleTimeout);
            }

            this.SendHeader();
            this.SendOpen(open);
            this.state = ConnectionState.OpenPipe;
        }