Ejemplo n.º 1
0
            protected override Message CreateWcfMessage()
            {
                string localIdentifier;

                if (base.Transaction != null)
                {
                    localIdentifier = base.Transaction.TransactionInformation.LocalIdentifier;
                }
                else
                {
                    localIdentifier = null;
                }
                string str = localIdentifier;

                MessagingClientEtwProvider.TraceClient(() => {
                });
                GetSessionStateCommand getSessionStateCommand = new GetSessionStateCommand()
                {
                    SessionId     = this.sbmpMessageSession.SessionId,
                    Timeout       = base.RemainingTime(),
                    TransactionId = str
                };
                GetSessionStateCommand getSessionStateCommand1 = getSessionStateCommand;
                RequestInfo            requestInfo             = new RequestInfo()
                {
                    ServerTimeout = new TimeSpan?(getSessionStateCommand1.Timeout),
                    TransactionId = getSessionStateCommand1.TransactionId
                };
                RequestInfo requestInfo1 = requestInfo;
                Message     message      = base.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/GetSessionState", getSessionStateCommand1, this.sbmpMessageSession.parentLinkId, this.sbmpMessageSession.RetryPolicy, this.trackingContext, requestInfo1);

                return(message);
            }
Ejemplo n.º 2
0
            protected override IEnumerator <IteratorAsyncResult <SbmpBrowsableMessageSession.GetStateAsyncResult> .AsyncStep> GetAsyncSteps()
            {
                object obj  = null;
                bool   flag = false;

                if (this.sbmpMessageSession.InnerMessageReceiver == null)
                {
                    bool flag1 = false;
                    try
                    {
                        object thisLock = this.sbmpMessageSession.ThisLock;
                        object obj1     = thisLock;
                        obj = thisLock;
                        Monitor.Enter(obj1, ref flag1);
                        this.sbmpMessageSession.resetEvent.WaitOne();
                    }
                    finally
                    {
                        if (flag1)
                        {
                            Monitor.Exit(obj);
                        }
                    }
                    try
                    {
                        if (this.sbmpMessageSession.InnerMessageReceiver != null)
                        {
                            goto Label0;
                        }
                        flag = true;
                        SbmpBrowsableMessageSession.GetStateAsyncResult getStateAsyncResult = this;
                        IteratorAsyncResult <SbmpBrowsableMessageSession.GetStateAsyncResult> .BeginCall beginCall = (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.BeginAcceptMessageSessionBrowser(t, c, s);
                        yield return(getStateAsyncResult.CallAsync(beginCall, (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, IAsyncResult r) => thisPtr.EndAcceptMessageSessionBrowser(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer));
                    }
                    finally
                    {
                        this.sbmpMessageSession.resetEvent.Set();
                    }
                }
Label0:
                if (this.sbmpMessageSession.InnerMessageReceiver != null && !flag)
                {
                    GetSessionStateCommand getSessionStateCommand = new GetSessionStateCommand()
                    {
                        SessionId     = this.sbmpMessageSession.SessionId,
                        Timeout       = base.RemainingTime(),
                        TransactionId = null,
                        IsBrowseMode  = true
                    };
                    GetSessionStateCommand getSessionStateCommand1 = getSessionStateCommand;
                    RequestInfo            requestInfo1            = new RequestInfo()
                    {
                        ServerTimeout = new TimeSpan?(getSessionStateCommand1.Timeout)
                    };
                    RequestInfo         requestInfo          = requestInfo1;
                    SbmpMessageReceiver innerMessageReceiver = (SbmpMessageReceiver)this.sbmpMessageSession.InnerMessageReceiver;
                    this.wcfMessage = innerMessageReceiver.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/GetSessionState", getSessionStateCommand1, null, this.sbmpMessageSession.RetryPolicy, this.trackingContext, requestInfo);
                    yield return(base.CallAsync((SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => innerMessageReceiver.SbmpMessagingFactory.Channel.BeginRequest(thisPtr.wcfMessage, SbmpProtocolDefaults.BufferTimeout(t, innerMessageReceiver.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), c, s), (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, IAsyncResult a) => thisPtr.Response = innerMessageReceiver.SbmpMessagingFactory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer));

                    if (base.LastAsyncStepException == null)
                    {
                        this.SessionState = this.Response.GetBody <GetSessionStateResponseCommand>().SessionState;
                    }
                }
            }