public void EndSend(IAsyncResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(EndSend)); SendAsyncResult.End <SendAsyncResult>(result); }
private void OnSendDone(IAsyncResult result) { SendAsyncResult sar = (SendAsyncResult)result; if (IsOneWay(sar.Telemetry) || sar.LastException != null) { // not expecting reply correlator.Remove(sar.RequestId); StopSendTelemetry(sar.Telemetry, null, sar.LastException, nameof(OnSendDone)); } }
private static void OnComplete(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SendAsyncResult sar = (SendAsyncResult)result.AsyncState; try { sar.InnerChannel.EndSend(sar.OriginalResult); sar.Complete(false); } catch (Exception ex) { sar.Complete(false, ex); } }
public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) { if (message == null) { throw new ArgumentNullException(nameof(message)); } WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(BeginSend)); var telemetry = StartSendTelemetry(message, nameof(BeginSend)); try { var result = new SendAsyncResult(DuplexChannel, message, timeout, this.OnSendDone, callback, state, telemetry); correlator.Add(message.Headers.MessageId, telemetry, timeout); return(result); } catch (Exception ex) { StopSendTelemetry(telemetry, null, ex, nameof(BeginSend)); throw; } }