Beispiel #1
0
        public void Initialize(QuicStream stream)
        {
            Debug.Assert(_stream == null);

            _stream = stream;

            if (!(_streamClosedTokenSource?.TryReset() ?? false))
            {
                _streamClosedTokenSource = new CancellationTokenSource();
            }

            ConnectionClosed = _streamClosedTokenSource.Token;

            InitializeFeatures();

            CanRead             = _stream.CanRead;
            CanWrite            = _stream.CanWrite;
            _error              = null;
            StreamId            = _stream.StreamId;
            PoolExpirationTicks = 0;

            Transport   = _originalTransport;
            Application = _originalApplication;

            _transportPipeReader.Reset();
            _transportPipeWriter.Reset();

            _connectionId        = null;
            _shutdownReason      = null;
            _writeAbortException = null;
            _streamClosed        = false;
            _serverAborted       = false;
            _clientAbort         = false;
            // TODO - resetable TCS
            _waitForConnectionClosedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);

            // Only reset pipes if the stream has been reused.
            if (CanReuse)
            {
                _inputPipe.Reset();
                _outputPipe.Reset();
            }

            CanReuse = false;
        }
Beispiel #2
0
    public void Initialize(QuicStream stream)
    {
        Debug.Assert(_stream == null);

        _stream = stream;

        _streamClosedTokenSource = null;
        _onClosedRegistrations?.Clear();

        InitializeFeatures();

        CanRead             = _stream.CanRead;
        CanWrite            = _stream.CanWrite;
        _error              = null;
        StreamId            = _stream.Id;
        PoolExpirationTicks = 0;

        Transport   = _originalTransport;
        Application = _originalApplication;

        _transportPipeReader.Reset();
        _transportPipeWriter.Reset();

        _connectionId        = null;
        _shutdownReason      = null;
        _writeAbortException = null;
        _streamClosed        = false;
        _serverAborted       = false;
        _clientAbort         = false;

        // Only reset pipes if the stream has been reused.
        if (CanReuse)
        {
            _inputPipe.Reset();
            _outputPipe.Reset();
        }

        CanReuse = false;
    }