Example #1
0
        public QuicConnectionContext(QuicConnection connection, QuicTransportContext context)
        {
            _log             = context.Log;
            _context         = context;
            _connection      = connection;
            ConnectionClosed = _connectionClosedTokenSource.Token;
            Features.Set <ITlsConnectionFeature>(new FakeTlsConnectionFeature());
            Features.Set <IProtocolErrorCodeFeature>(this);

            _log.AcceptedConnection(this);
        }
        public async ValueTask <MultiplexedConnectionContext?> AcceptAsync(IFeatureCollection?features = null, CancellationToken cancellationToken = default)
        {
            try
            {
                var quicConnection = await _listener.AcceptConnectionAsync(cancellationToken);

                var connectionContext = new QuicConnectionContext(quicConnection, _context);

                _log.AcceptedConnection(connectionContext);

                return(connectionContext);
            }
            catch (QuicOperationAbortedException ex)
            {
                _log.LogDebug($"Listener has aborted with exception: {ex.Message}");
            }
            return(null);
        }