public MsQuicConnectionListener(MsQuicTransportOptions options, IHostApplicationLifetime lifetime, IMsQuicTrace log, EndPoint endpoint) { _api = new MsQuicApi(); _log = log; _transportContext = new MsQuicTransportContext(lifetime, _log, options); EndPoint = endpoint; }
public MsQuicConnection(MsQuicApi api, MsQuicTransportContext context, IntPtr nativeObjPtr) { _api = api; _context = context; _log = context.Log; _nativeObjPtr = nativeObjPtr; SetCallbackHandler(); SetIdleTimeout(_context.Options.IdleTimeout); Features.Set <IQuicStreamListenerFeature>(this); Features.Set <IQuicCreateStreamFeature>(this); _log.NewConnection(ConnectionId); }
public MsQuicStream(MsQuicApi api, MsQuicConnection connection, MsQuicTransportContext context, QUIC_STREAM_OPEN_FLAG flags, IntPtr nativeObjPtr) { Debug.Assert(connection != null); Api = api; _nativeObjPtr = nativeObjPtr; _connection = connection; MemoryPool = context.Options.MemoryPoolFactory(); _log = context.Log; ConnectionClosed = _streamClosedTokenSource.Token; var maxReadBufferSize = context.Options.MaxReadBufferSize.Value; var maxWriteBufferSize = context.Options.MaxWriteBufferSize.Value; _resettableCompletion = new ResettableCompletionSource(this); // TODO should we allow these PipeScheduler to be configurable here? var inputOptions = new PipeOptions(MemoryPool, PipeScheduler.ThreadPool, PipeScheduler.Inline, maxReadBufferSize, maxReadBufferSize / 2, useSynchronizationContext: false); var outputOptions = new PipeOptions(MemoryPool, PipeScheduler.Inline, PipeScheduler.ThreadPool, maxWriteBufferSize, maxWriteBufferSize / 2, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(inputOptions, outputOptions); // TODO when stream is unidirectional, don't create an output pipe. if (flags.HasFlag(QUIC_STREAM_OPEN_FLAG.UNIDIRECTIONAL)) { Features.Set <IUnidirectionalStreamFeature>(this); } // TODO populate the ITlsConnectionFeature (requires client certs). var feature = new FakeTlsConnectionFeature(); Features.Set <ITlsConnectionFeature>(feature); Transport = pair.Transport; Application = pair.Application; SetCallbackHandler(); _processingTask = ProcessSends(); // Concatenate stream id with ConnectionId. _log.NewStream(ConnectionId); }
public MsQuicTransportContext(IHostApplicationLifetime appLifetime, IMsQuicTrace log, MsQuicTransportOptions options) { AppLifetime = appLifetime; Log = log; Options = options; }