protected override IEnumerator <IteratorAsyncResult <AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult> .AsyncStep> GetAsyncSteps() { string str = "$cbs"; if (base.RemainingTime() > TimeSpan.Zero) { try { AmqpSessionSettings amqpSessionSetting = new AmqpSessionSettings() { Properties = new Fields() }; this.session = new AmqpSession(this.connection, amqpSessionSetting, this); this.connection.AddSession(this.session, null); } catch (InvalidOperationException invalidOperationException1) { InvalidOperationException invalidOperationException = invalidOperationException1; base.Complete(new MessagingException(invalidOperationException.Message, false, invalidOperationException)); goto Label0; } AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult openCbsRequestResponseLinkAsyncResult = this; IteratorAsyncResult <AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult> .BeginCall beginCall = (AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.session.BeginOpen(t, c, s); yield return(openCbsRequestResponseLinkAsyncResult.CallAsync(beginCall, (AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult thisPtr, IAsyncResult r) => thisPtr.session.EndOpen(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); Exception lastAsyncStepException = base.LastAsyncStepException; if (lastAsyncStepException == null) { AmqpLinkSettings amqpLinkSetting = new AmqpLinkSettings(); AmqpLinkSettings amqpLinkSetting1 = amqpLinkSetting; AmqpSymbol timeoutName = ClientConstants.TimeoutName; TimeSpan timeSpan = base.RemainingTime(); amqpLinkSetting1.AddProperty(timeoutName, (uint)timeSpan.TotalMilliseconds); amqpLinkSetting.Target = new Target() { Address = str }; amqpLinkSetting.Source = new Source() { Address = str }; amqpLinkSetting.InitialDeliveryCount = new uint?(0); amqpLinkSetting.TotalLinkCredit = 50; amqpLinkSetting.AutoSendFlow = true; amqpLinkSetting.SettleType = SettleMode.SettleOnSend; this.Link = new RequestResponseAmqpLink(this.session, amqpLinkSetting); AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult openCbsRequestResponseLinkAsyncResult1 = this; IteratorAsyncResult <AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult> .BeginCall beginCall1 = (AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.Link.BeginOpen(t, c, s); yield return(openCbsRequestResponseLinkAsyncResult1.CallAsync(beginCall1, (AmqpCbsLink.OpenCbsRequestResponseLinkAsyncResult thisPtr, IAsyncResult r) => thisPtr.Link.EndOpen(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); lastAsyncStepException = base.LastAsyncStepException; if (lastAsyncStepException == null) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteAmqpOpenEntitySucceeded(this.connection, this.Link, this.Link.Name, str)); } else { this.Link = null; MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteAmqpOpenEntityFailed(this.connection, this.Link, this.Link.Name, str, lastAsyncStepException.Message)); this.session.SafeClose(); base.Complete(Microsoft.ServiceBus.Messaging.Amqp.ExceptionHelper.ToMessagingContract(lastAsyncStepException, this.connection.RemoteEndpoint.ToString())); } } else { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteAmqpOpenEntityFailed(this.connection, this.session, string.Empty, str, lastAsyncStepException.Message)); this.session.Abort(); base.Complete(Microsoft.ServiceBus.Messaging.Amqp.ExceptionHelper.ToMessagingContract(lastAsyncStepException, this.connection.RemoteEndpoint.ToString())); } } else { if (this.session != null) { this.session.SafeClose(); } base.Complete(new TimeoutException(SRAmqp.AmqpTimeout(base.OriginalTimeout, str))); } Label0: yield break; }
protected virtual void CompleteOnTimer() { this.CompleteInternal(false, new TimeoutException(SRAmqp.AmqpTimeout(this.timeout, this.Target))); }