OnBegin() private method

private OnBegin ( ushort remoteChannel, Amqp.Framing.Begin begin ) : void
remoteChannel ushort
begin Amqp.Framing.Begin
return void
Exemplo n.º 1
0
        internal virtual void OnBegin(ushort remoteChannel, Begin begin)
        {
            lock (this.ThisLock)
            {
                if (remoteChannel > this.channelMax)
                {
                    throw new AmqpException(ErrorCode.NotAllowed,
                                            Fx.Format(SRAmqp.AmqpHandleExceeded, this.channelMax + 1));
                }

                Session session = this.GetSession(this.localSessions, begin.RemoteChannel);
                session.OnBegin(remoteChannel, begin);

                int count = this.remoteSessions.Length;
                if (count - 1 < remoteChannel)
                {
                    int       size     = Math.Min(count * 2, this.channelMax + 1);
                    Session[] expanded = new Session[size];
                    Array.Copy(this.remoteSessions, expanded, count);
                    this.remoteSessions = expanded;
                }

                var remoteSession = this.remoteSessions[remoteChannel];
                if (remoteSession != null)
                {
                    throw new AmqpException(ErrorCode.HandleInUse,
                                            Fx.Format(SRAmqp.AmqpHandleInUse, remoteChannel, remoteSession.GetType().Name));
                }

                this.remoteSessions[remoteChannel] = session;
            }
        }
Exemplo n.º 2
0
        internal virtual void OnBegin(ushort remoteChannel, Begin begin)
        {
            this.ValidateChannel(remoteChannel);

            lock (this.ThisLock)
            {
                Session session = this.GetSession(this.localSessions, begin.RemoteChannel);
                session.OnBegin(remoteChannel, begin);

                int count = this.remoteSessions.Length;
                if (count - 1 < remoteChannel)
                {
                    int size = count * 2;
                    while (size - 1 < remoteChannel)
                    {
                        size *= 2;
                    }

                    Session[] expanded = new Session[size];
                    Array.Copy(this.remoteSessions, expanded, count);
                    this.remoteSessions = expanded;
                }

                var remoteSession = this.remoteSessions[remoteChannel];
                if (remoteSession != null)
                {
                    throw new AmqpException(ErrorCode.HandleInUse,
                                            Fx.Format(SRAmqp.AmqpHandleInUse, remoteChannel, remoteSession.GetType().Name));
                }

                this.remoteSessions[remoteChannel] = session;
            }
        }
 internal virtual void OnBegin(ushort remoteChannel, Begin begin)
 {
     lock (this.ThisLock)
     {
         Session session = this.GetSession(this.localSessions, begin.RemoteChannel);
         session.OnBegin(remoteChannel, begin);
         this.remoteSessions[remoteChannel] = session;
     }
 }