示例#1
0
        protected void Upgrade()
        {
            uint valueOrDefault;
            uint num;

            if (!this.upgraded)
            {
                this.links = new Dictionary <string, AmqpLink>();
                uint?handleMax = this.settings.HandleMax;
                if (handleMax.HasValue)
                {
                    valueOrDefault = handleMax.GetValueOrDefault();
                }
                else
                {
                    valueOrDefault = -1;
                }
                this.linksByLocalHandle = new HandleTable <AmqpLink>(valueOrDefault);
                uint?nullable = this.settings.HandleMax;
                if (nullable.HasValue)
                {
                    num = nullable.GetValueOrDefault();
                }
                else
                {
                    num = -1;
                }
                this.linksByRemoteHandle = new HandleTable <AmqpLink>(num);
                this.outgoingChannel     = new AmqpSession.OutgoingSessionChannel(this);
                this.incomingChannel     = new AmqpSession.IncomingSessionChannel(this);
                this.upgraded            = true;
            }
        }
示例#2
0
            public bool TrySendTransfer(Delivery delivery, Transfer transfer, ArraySegment <byte>[] payload)
            {
                bool flag;

                lock (base.SyncRoot)
                {
                    if (this.outgoingWindow != 0)
                    {
                        this.nextOutgoingId.Increment();
                        AmqpSession.OutgoingSessionChannel outgoingSessionChannel = this;
                        outgoingSessionChannel.outgoingWindow = outgoingSessionChannel.outgoingWindow - 1;
                        if (delivery == null)
                        {
                            transfer.DeliveryId = null;
                        }
                        else
                        {
                            base.AddDelivery(delivery);
                            transfer.DeliveryId = new uint?(delivery.DeliveryId.Value);
                        }
                        base.Session.SendCommand(transfer, payload);
                        return(true);
                    }
                    else
                    {
                        MessagingClientEtwProvider.TraceClient <AmqpSession.OutgoingSessionChannel>((AmqpSession.OutgoingSessionChannel source) => {
                        }, this);
                        flag = false;
                    }
                }
                return(flag);
            }
示例#3
0
        public AmqpSession(AmqpConnection connection, AmqpSessionSettings settings, ILinkFactory linkFactory) : base("session")
        {
            uint valueOrDefault;
            uint num;

            this.connection  = connection;
            this.settings    = settings;
            this.linkFactory = linkFactory;
            base.State       = AmqpObjectState.Start;
            this.links       = new Dictionary <string, AmqpLink>();
            uint?handleMax = settings.HandleMax;

            if (handleMax.HasValue)
            {
                valueOrDefault = handleMax.GetValueOrDefault();
            }
            else
            {
                valueOrDefault = -1;
            }
            this.linksByLocalHandle = new HandleTable <AmqpLink>(valueOrDefault);
            uint?nullable = settings.HandleMax;

            if (nullable.HasValue)
            {
                num = nullable.GetValueOrDefault();
            }
            else
            {
                num = -1;
            }
            this.linksByRemoteHandle = new HandleTable <AmqpLink>(num);
            this.outgoingChannel     = new AmqpSession.OutgoingSessionChannel(this);
            this.incomingChannel     = new AmqpSession.IncomingSessionChannel(this);
            this.upgraded            = true;
        }