public void CompleteAttach()

in src/Listener/ListenerLink.cs [182:226]


        public void CompleteAttach(Attach attach, Error error)
        {
            if (error != null)
            {
                this.SendAttach(attach.InitialDeliveryCount, new Attach() { Target = null, Source = null });
            }
            else
            {
                if (!this.Role)
                {
                    this.deliveryCount = attach.InitialDeliveryCount;
                }

                this.SendAttach(attach.InitialDeliveryCount, attach);
            }

            base.OnAttach(attach.Handle, attach);

            if (error != null)
            {
                this.CloseInternal(0, error);
            }
            else
            {
                if (this.Role)
                {
                    this.SendFlow(this.deliveryCount, this.credit, false);
                }
                else
                {
                    // flow could be processed while attach is in progress
                    if (this.credit > 0)
                    {
                        if (this.linkEndpoint != null)
                        {
                            this.linkEndpoint.OnFlow(new FlowContext(this, (int)this.credit, null));
                        }
                        else if (this.onCredit != null)
                        {
                            this.onCredit((int)this.credit, null, this.state);
                        }
                    }
                }
            }
        }