Ejemplo n.º 1
0
        protected virtual void Dispose(bool disposing)
        {
            _output.CompleteWriter();
            _output.CompleteReader();

            _input.CompleteWriter();
            _input.CompleteReader();
        }
Ejemplo n.º 2
0
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);

                _readerWriter.CompleteReader();
                _readerWriter.CompleteWriter();
            }
Ejemplo n.º 3
0
        /// <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;
            }
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
 public void Complete(Exception exception = null)
 {
     _readerWriter.CompleteReader(exception);
 }