Amqp.Link.OnClose C# (CSharp) Method

OnClose() protected method

Closes the link.
protected OnClose ( Error error ) : bool
error Error The error.
return bool
        protected override bool OnClose(Error error)
        {
            lock (this.ThisLock)
            {
                if (this.state == LinkState.End)
                {
                    return true;
                }
                else if (this.state == LinkState.AttachSent)
                {
                    this.state = LinkState.DetachPipe;
                }
                else if (this.state == LinkState.Attached)
                {
                    this.state = LinkState.DetachSent;
                }
                else if (this.state == LinkState.DetachReceived)
                {
                    this.state = LinkState.End;
                }
                else
                {
                    throw new AmqpException(ErrorCode.IllegalState,
                        Fx.Format(SRAmqp.AmqpIllegalOperationState, "Close", this.state));
                }

                this.SendDetach(error);
                return this.state == LinkState.End;
            }
        }