void OnOpen(Open open)
{
lock (this.ThisLock)
{
if (this.state == State.OpenSent)
{
this.state = State.Opened;
}
else if (this.state == State.ClosePipe)
{
this.state = State.CloseSent;
}
else
{
throw new AmqpException(ErrorCode.IllegalState,
Fx.Format(SRAmqp.AmqpIllegalOperationState, "OnOpen", this.state));
}
}
if (open.ChannelMax < this.channelMax)
{
this.channelMax = open.ChannelMax;
}
if (open.MaxFrameSize < this.maxFrameSize)
{
this.maxFrameSize = open.MaxFrameSize;
}
uint idleTimeout = open.IdleTimeOut;
if (idleTimeout > 0 && idleTimeout < uint.MaxValue)
{
idleTimeout -= 3000;
if (idleTimeout > MaxIdleTimeout)
{
idleTimeout = MaxIdleTimeout;
}
this.heartBeatTimer = new Timer(onHeartBeatTimer, this, (int)idleTimeout, (int)idleTimeout);
}
if (this.onOpened != null)
{
this.onOpened(this, open);
}
}