예제 #1
0
        protected virtual void Dispose(bool disposing)
        {
            _output.CompleteWriter();
            _output.CompleteReader();

            _input.CompleteWriter();
            _input.CompleteReader();
        }
예제 #2
0
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);

                _readerWriter.CompleteReader();
                _readerWriter.CompleteWriter();
            }
예제 #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;
            }
        }
예제 #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();
        }
예제 #5
0
 public void Complete(Exception exception = null)
 {
     _readerWriter.CompleteReader(exception);
 }