protected virtual void Dispose(bool disposing) { _output.CompleteWriter(); _output.CompleteReader(); _input.CompleteWriter(); _input.CompleteReader(); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); _readerWriter.CompleteReader(); _readerWriter.CompleteWriter(); }
/// <summary> /// Releases all resources owned by the connection /// </summary> protected virtual void Dispose(bool disposing) { if (disposing) { _output.CompleteWriter(); _output.CompleteReader(); _input.CompleteWriter(); _input.CompleteReader(); GC.SuppressFinalize(this); _socket?.Dispose(); _socket = null; if (_ownsFactory) { _factory?.Dispose(); } _factory = null; } }
private async Task ProcessSends() { while (true) { var result = await _output.ReadAsync(); var buffer = result.Buffer; if (buffer.IsEmpty && result.IsCompleted) { break; } var enumerator = buffer.GetEnumerator(); if (enumerator.MoveNext()) { var current = enumerator.Current; while (enumerator.MoveNext()) { var next = enumerator.Current; await SendAsync(current, endOfMessage : false); current = next; } await PreviousSendingComplete; _sendingBuffer = buffer.Preserve(); await SendAsync(current, endOfMessage : true); } _output.Advance(buffer.End); } _output.CompleteReader(); }
public void Complete(Exception exception = null) { _readerWriter.CompleteReader(exception); }