コード例 #1
0
        // For testing
        public LibuvTransport(LibuvFunctions uv, LibuvTransportContext context, IEndPointInformation endPointInformation)
        {
            Libuv            = uv;
            TransportContext = context;

            _endPointInformation = endPointInformation;
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public LibuvTransportFactory(
            IOptions <LibuvTransportOptions> options,
            IApplicationLifetime 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("RaySocket.Transport.Libuv");
            var trace  = new LibuvTrace(logger);

            var threadCount = options.Value.ThreadCount;

            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,
            };
        }
コード例 #4
0
 public Listener(LibuvTransportContext transportContext) : base(transportContext)
 {
 }
コード例 #5
0
 public ListenerContext(LibuvTransportContext transportContext)
 {
     TransportContext = transportContext;
 }
コード例 #6
0
 public LibuvTransport(LibuvTransportContext context, IEndPointInformation endPointInformation)
     : this(new LibuvFunctions(), context, endPointInformation)
 {
 }
コード例 #7
0
 public ListenerSecondary(LibuvTransportContext transportContext) : base(transportContext)
 {
     _ptr = Marshal.AllocHGlobal(4);
 }