private async Task OnConnectionSendAsync(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > settings.MaxRetryCount) { if (WcfEventSource.Instance.MaxRetryCyclesExceededIsEnabled()) { WcfEventSource.Instance.MaxRetryCyclesExceeded(SR.MaximumRetryCountExceeded); } session.OnLocalFault(new CommunicationException(SR.MaximumRetryCountExceeded, maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(session.OutputID), null); return; } AddAcknowledgementHeader(attemptInfo.Message, false); session.OnLocalActivity(); Message reply = null; MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (attemptInfo.RetryCount < settings.MaxRetryCount) { maskingMode |= MaskingMode.Handled; reply = await binder.RequestAsync(attemptInfo.Message, timeout, maskingMode); } else { try { reply = await binder.RequestAsync(attemptInfo.Message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (binder.IsHandleable(e)) { maxRetryCountException = e; } else { throw; } } } if (reply != null) { ProcessReply(reply, (IReliableRequest)attemptInfo.State, attemptInfo.GetSequenceNumber()); } } }
void OnConnectionSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { if (TD.MaxRetryCyclesExceededIsEnabled()) { TD.MaxRetryCyclesExceeded(SR.GetString(SR.MaximumRetryCountExceeded)); } this.session.OnLocalFault(new CommunicationException(SR.GetString(SR.MaximumRetryCountExceeded), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); return; } this.AddAcknowledgementHeader(attemptInfo.Message, false); this.session.OnLocalActivity(); Message reply = null; MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (attemptInfo.RetryCount < this.settings.MaxRetryCount) { maskingMode |= MaskingMode.Handled; reply = this.binder.Request(attemptInfo.Message, timeout, maskingMode); } else { try { reply = this.binder.Request(attemptInfo.Message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (this.binder.IsHandleable(e)) { this.maxRetryCountException = e; } else { throw; } } } if (reply != null) { ProcessReply(reply, (IReliableRequest)attemptInfo.State, attemptInfo.GetSequenceNumber()); } } }
IAsyncResult OnConnectionBeginSendHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException, AsyncCallback callback, object state) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { if (TD.MaxRetryCyclesExceededIsEnabled()) { TD.MaxRetryCyclesExceeded(SR.GetString(SR.MaximumRetryCountExceeded)); } this.session.OnLocalFault(new CommunicationException(SR.GetString(SR.MaximumRetryCountExceeded), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); return(new CompletedAsyncResult(callback, state)); } else { this.session.OnLocalActivity(); return(this.OnConnectionBeginSend(attemptInfo, timeout, maskUnhandledException, callback, state)); } }
private async Task OnConnectionSendAsyncHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > Settings.MaxRetryCount) { if (WcfEventSource.Instance.MaxRetryCyclesExceededIsEnabled()) { WcfEventSource.Instance.MaxRetryCyclesExceeded(SR.MaximumRetryCountExceeded); } _session.OnLocalFault(new CommunicationException(SR.MaximumRetryCountExceeded, _maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(_session.OutputID), null); } else { _session.OnLocalActivity(); await OnConnectionSendAsync(attemptInfo.Message, timeout, (attemptInfo.RetryCount == Settings.MaxRetryCount), maskUnhandledException); } } }
void OnConnectionSendHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { if (TD.MaxRetryCyclesExceededIsEnabled()) { TD.MaxRetryCyclesExceeded(SR.GetString(SR.MaximumRetryCountExceeded)); } this.session.OnLocalFault(new CommunicationException(SR.GetString(SR.MaximumRetryCountExceeded), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); } else { this.session.OnLocalActivity(); OnConnectionSend(attemptInfo.Message, timeout, (attemptInfo.RetryCount == this.settings.MaxRetryCount), maskUnhandledException); } } }
IAsyncResult OnConnectionBeginSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException, AsyncCallback callback, object state) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { if (TD.MaxRetryCyclesExceededIsEnabled()) { TD.MaxRetryCyclesExceeded(SR.GetString(SR.MaximumRetryCountExceeded)); } this.session.OnLocalFault(new CommunicationException(SR.GetString(SR.MaximumRetryCountExceeded), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); return(new CompletedAsyncResult(callback, state)); } else { this.session.OnLocalActivity(); this.AddAcknowledgementHeader(attemptInfo.Message, false); ReliableBinderRequestAsyncResult result = new ReliableBinderRequestAsyncResult(callback, state); result.Binder = this.binder; result.MessageAttemptInfo = attemptInfo; result.MaskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (attemptInfo.RetryCount < this.settings.MaxRetryCount) { result.MaskingMode |= MaskingMode.Handled; result.SaveHandledException = false; } else { result.SaveHandledException = true; } result.Begin(timeout); return(result); } }
private void OnConnectionSendHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { this.session.OnLocalFault(new CommunicationException(System.ServiceModel.SR.GetString("MaximumRetryCountExceeded"), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); } else { this.session.OnLocalActivity(); this.OnConnectionSend(attemptInfo.Message, timeout, attemptInfo.RetryCount == this.settings.MaxRetryCount, maskUnhandledException); } } }