public TryReceiveAsyncResult(TransportDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.channel = channel; bool completeSelf = false; try { IAsyncResult result = this.channel.BeginReceive(timeout, onReceive, this); if (result.CompletedSynchronously) { this.CompleteReceive(result); completeSelf = true; } } catch (TimeoutException e) { if (TD.ReceiveTimeoutIsEnabled()) { TD.ReceiveTimeout(e.Message); } DiagnosticUtility.TraceHandledException(e, TraceEventType.Information); completeSelf = true; } if (completeSelf) { this.Complete(true); } }
public SendAsyncResult(TransportDuplexSessionChannel channel, Message message, TimeSpan timeout, bool streamedOutput, AsyncCallback callback, object state) : base(callback, state) { this.timeoutHelper = new TimeoutHelper(timeout); this.channel = channel; this.message = message; this.streamedOutput = streamedOutput; if (!channel.sendLock.EnterAsync(this.timeoutHelper.RemainingTime(), onEnterComplete, this)) { return; } bool completeSelf = false; bool writeSuccess = false; try { completeSelf = this.WriteCore(); writeSuccess = true; } finally { if (!writeSuccess) { this.Cleanup(false, true); } } if (completeSelf) { this.Cleanup(true, true); this.Complete(true); } }
public CloseAsyncResult(TransportDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.channel = channel; this.timeoutHelper = new TimeoutHelper(timeout); IAsyncResult result = this.channel.BeginCloseOutputSession(this.timeoutHelper.RemainingTime(), onCloseOutputSession, this); if (!result.CompletedSynchronously) { return; } if (!this.HandleCloseOutputSession(result, true)) { return; } this.Complete(true); }
public CloseOutputSessionAsyncResult(TransportDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { channel.ThrowIfNotOpened(); channel.ThrowIfFaulted(); this.timeoutHelper = new TimeoutHelper(timeout); this.channel = channel; if (!channel.sendLock.EnterAsync(this.timeoutHelper.RemainingTime(), onEnterComplete, this)) { return; } bool completeSelf = false; bool writeSuccess = false; try { completeSelf = this.WriteEndBytes(); writeSuccess = true; } finally { if (!writeSuccess) { this.Cleanup(false, true); } } if (completeSelf) { this.Cleanup(true, true); this.Complete(true); } }
public ConnectionDuplexSession(TransportDuplexSessionChannel channel) : base() { _channel = channel; }
public ConnectionDuplexSession(TransportDuplexSessionChannel channel) : base() { Channel = channel; }