// For testing public LibuvConnectionListener(LibuvFunctions uv, LibuvTransportContext context, EndPoint endPoint) { Libuv = uv; TransportContext = context; EndPoint = endPoint; }
// For testing public LibuvTransport(LibuvFunctions uv, LibuvTransportContext context, IEndPointInformation endPointInformation) { Libuv = uv; TransportContext = context; _endPointInformation = endPointInformation; }
public ITransport Create(IEndPointInformation endPointInformation, IConnectionDispatcher dispatcher) { var transportContext = new LibuvTransportContext { Options = _baseTransportContext.Options, AppLifetime = _baseTransportContext.AppLifetime, Log = _baseTransportContext.Log, ConnectionDispatcher = dispatcher }; return(new LibuvTransport(transportContext, endPointInformation)); }
public LibuvTransportFactory( #pragma warning disable CS0618 IOptions <LibuvTransportOptions> options, #pragma warning restore CS0618 IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (applicationLifetime == null) { throw new ArgumentNullException(nameof(applicationLifetime)); } if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } var logger = loggerFactory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv"); var trace = new LibuvTrace(logger); #pragma warning disable CS0618 var threadCount = options.Value.ThreadCount; #pragma warning restore CS0618 if (threadCount <= 0) { throw new ArgumentOutOfRangeException(nameof(threadCount), threadCount, "ThreadCount must be positive."); } if (!LibuvConstants.ECONNRESET.HasValue) { trace.LogWarning("Unable to determine ECONNRESET value on this platform."); } if (!LibuvConstants.EADDRINUSE.HasValue) { trace.LogWarning("Unable to determine EADDRINUSE value on this platform."); } _baseTransportContext = new LibuvTransportContext { Options = options.Value, AppLifetime = applicationLifetime, Log = trace, }; }
public async ValueTask <IConnectionListener> BindAsync(EndPoint endpoint, CancellationToken cancellationToken = default) { var transportContext = new LibuvTransportContext { Options = _baseTransportContext.Options, AppLifetime = _baseTransportContext.AppLifetime, Log = _baseTransportContext.Log }; var transport = new LibuvConnectionListener(transportContext, endpoint); await transport.BindAsync(); return(transport); }
public LibuvConnectionListener(LibuvTransportContext context, EndPoint endPoint) : this(new LibuvFunctions(), context, endPoint) { }
public ListenerContext(LibuvTransportContext transportContext) { TransportContext = transportContext; }
public ListenerPrimary(LibuvTransportContext transportContext) : base(transportContext) { }
public ListenerSecondary(LibuvTransportContext transportContext) : base(transportContext) => _ptr = Marshal.AllocHGlobal(4);
public LibuvThread(LibuvFunctions libuv, LibuvTransportContext libuvTransportContext, int maxLoops = 8) : this(libuv, libuvTransportContext.AppLifetime, libuvTransportContext.Options.MemoryPoolFactory(), libuvTransportContext.Log, maxLoops) { }
public LibuvTransport(LibuvTransportContext context, IEndPointInformation endPointInformation) : this(new LibuvFunctions(), context, endPointInformation) { }