Пример #1
0
        private void ReleaseRequestEntry(MQRequestEntry entry)
        {
            uint method = 0x620;

            this.TrEntry(method, new object[] { entry });
            try
            {
                lock (this.requestEntryMutex)
                {
                    base.TrData(method, 0, "Current RequestId being released = ", BitConverter.GetBytes(entry.RequestID));
                    MQRequestEntry previous = entry.Previous;
                    MQRequestEntry next     = entry.Next;
                    if (previous == null)
                    {
                        this.exchangeRequests = next;
                    }
                    else
                    {
                        previous.Next = next;
                    }
                    if (next != null)
                    {
                        next.Previous = previous;
                    }
                    if (this.cachedExchangeRequest == null)
                    {
                        this.cachedExchangeRequest = entry;
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
Пример #2
0
        private MQRequestEntry AllocateRequestEntry()
        {
            MQRequestEntry entry3;
            uint           method = 0x61f;

            this.TrEntry(method);
            try
            {
                lock (this.requestEntryMutex)
                {
                    MQRequestEntry cachedExchangeRequest;
                    if (this.cachedExchangeRequest != null)
                    {
                        cachedExchangeRequest       = this.cachedExchangeRequest;
                        this.cachedExchangeRequest  = null;
                        cachedExchangeRequest.Reply = null;
                    }
                    else
                    {
                        cachedExchangeRequest = new MQRequestEntry();
                    }
                    int num2 = 3;
                    for (MQRequestEntry entry2 = this.exchangeRequests; entry2 != null; entry2 = entry2.Next)
                    {
                        if (entry2.RequestID >= num2)
                        {
                            num2 = entry2.RequestID + 2;
                        }
                    }
                    cachedExchangeRequest.RequestID = num2;
                    if (this.exchangeRequests != null)
                    {
                        this.exchangeRequests.Previous = cachedExchangeRequest;
                    }
                    cachedExchangeRequest.Next     = this.exchangeRequests;
                    cachedExchangeRequest.Previous = null;
                    this.exchangeRequests          = cachedExchangeRequest;
                    base.TrData(method, 0, "Current RequestId allocated = ", BitConverter.GetBytes(cachedExchangeRequest.RequestID));
                    entry3 = cachedExchangeRequest;
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(entry3);
        }
Пример #3
0
        internal void DeliverExchangeReply(int requestId, MQTSH tsh)
        {
            uint method = 0x61e;

            this.TrEntry(method, new object[] { requestId, tsh });
            try
            {
                tsh = this.ProcessReceivedData(tsh);
                lock (this.requestEntryMutex)
                {
                    MQRequestEntry exchangeRequests = this.exchangeRequests;
                    while ((exchangeRequests != null) && (exchangeRequests.RequestID != requestId))
                    {
                        exchangeRequests = exchangeRequests.Next;
                    }
                    if (exchangeRequests == null)
                    {
                        CommonServices.SetValidInserts();
                        CommonServices.ArithInsert1   = (uint)requestId;
                        CommonServices.ArithInsert2   = tsh.SegmentType;
                        CommonServices.CommentInsert1 = "Unexpected flow received in DeliverExchangeReply";
                        CommonServices.CommentInsert2 = "Cached RequestEntry is null for given RequestId";
                        base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0);
                        NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null);
                        base.TrException(method, ex);
                        throw ex;
                    }
                    lock (exchangeRequests)
                    {
                        exchangeRequests.Reply = tsh;
                        Monitor.Pulse(exchangeRequests);
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
Пример #4
0
        internal MQTSH ExchangeTSH(MQTSH requestTsh)
        {
            uint method = 0x622;

            this.TrEntry(method, new object[] { requestTsh });
            MQTSH result = null;

            try
            {
                MQRequestEntry entry2;
                if (this.disconnected)
                {
                    NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure);
                    base.TrException(method, ex);
                    this.connectionBroken = true;
                    this.hconn.RaiseEvent(0x7d9);
                }
                MQRequestEntry entry = this.AllocateRequestEntry();
                requestTsh.SetRequestId(entry.RequestID);
                byte[] bytes = BitConverter.GetBytes(IPAddress.NetworkToHostOrder(entry.RequestID));
                for (int i = 12; i < 0x10; i++)
                {
                    requestTsh.TshBuffer[i] = bytes[i - 12];
                }
                requestTsh.ControlFlags1 = (byte)(requestTsh.ControlFlags1 | 1);
                this.SendData(requestTsh.TshBuffer, 0, requestTsh.Length, requestTsh.SegmentType, 1);
                Monitor.Enter(entry2 = entry);
                try
                {
                    while (entry.Reply == null)
                    {
                        Monitor.Wait(entry, this.rmtReqEntMaxPollTime, true);
                        if ((this.asyncFailure != null) || !this.Connection.IsConnected)
                        {
                            NmqiException exception2 = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure);
                            base.TrException(method, exception2);
                            throw exception2;
                        }
                    }
                }
                catch (ThreadInterruptedException exception3)
                {
                    string str = "Interrupted while waiting for exchange reply";
                    CommonServices.SetValidInserts();
                    CommonServices.ArithInsert1   = (uint)this.conversationId;
                    CommonServices.ArithInsert2   = (uint)entry.RequestID;
                    CommonServices.CommentInsert1 = str;
                    base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x8e1, 0);
                    NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x893, exception3);
                    base.TrException(method, exception4);
                    throw exception4;
                }
                finally
                {
                    Monitor.Exit(entry2);
                }
                result = entry.Reply;
                this.ReleaseRequestEntry(entry);
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }