コード例 #1
0
        public Task StartAsync(
            IEndPointInformation endPointInformation,
            LibuvThread thread)
        {
            EndPointInformation = endPointInformation;
            Thread = thread;

            return(Thread.PostAsync(listener =>
            {
                listener.ListenSocket = listener.CreateListenSocket();
                listener.ListenSocket.Listen(LibuvConstants.ListenBacklog, ConnectionCallback, listener);
            }, this));
        }
コード例 #2
0
 public LibuvOutputConsumer(
     PipeReader pipe,
     LibuvThread thread,
     UvStreamHandle socket,
     string connectionId,
     ILibuvTrace log)
 {
     _pipe         = pipe;
     _thread       = thread;
     _socket       = socket;
     _connectionId = connectionId;
     _log          = log;
 }
コード例 #3
0
ファイル: LibuvConnection.cs プロジェクト: bclnet/GameNetCore
        public LibuvConnection(UvStreamHandle socket, ILibuvTrace log, LibuvThread thread, IPEndPoint remoteEndPoint, IPEndPoint localEndPoint)
        {
            _socket = socket;

            RemoteAddress = remoteEndPoint?.Address;
            RemotePort    = remoteEndPoint?.Port ?? 0;

            LocalAddress = localEndPoint?.Address;
            LocalPort    = localEndPoint?.Port ?? 0;

            ConnectionClosed = _connectionClosedTokenSource.Token;
            Log    = log;
            Thread = thread;
        }
コード例 #4
0
        public Task StartAsync(
            string pipeName,
            byte[] pipeMessage,
            IEndPointInformation endPointInformation,
            LibuvThread thread)
        {
            _pipeName    = pipeName;
            _pipeMessage = pipeMessage;
            _buf         = thread.Loop.Libuv.buf_init(_ptr, 4);

            EndPointInformation = endPointInformation;
            Thread       = thread;
            DispatchPipe = new UvPipeHandle(Log);

            var tcs = new TaskCompletionSource <int>(this, TaskCreationOptions.RunContinuationsAsynchronously);

            Thread.Post(StartCallback, tcs);
            return(tcs.Task);
        }
コード例 #5
0
ファイル: ListenerPrimary.cs プロジェクト: bclnet/GameNetCore
        public async Task StartAsync(
            string pipeName,
            byte[] pipeMessage,
            IEndPointInformation endPointInformation,
            LibuvThread thread)
        {
            _pipeName    = pipeName;
            _pipeMessage = pipeMessage;

            if (_fileCompletionInfoPtr == IntPtr.Zero)
            {
                var fileCompletionInfo = new FILE_COMPLETION_INFORMATION {
                    Key = IntPtr.Zero, Port = IntPtr.Zero
                };
                _fileCompletionInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(fileCompletionInfo));
                Marshal.StructureToPtr(fileCompletionInfo, _fileCompletionInfoPtr, false);
            }

            await StartAsync(endPointInformation, thread).ConfigureAwait(false);

            await Thread.PostAsync(listener => listener.PostCallback(), this).ConfigureAwait(false);
        }
コード例 #6
0
 public WriteReqPool(LibuvThread thread, ILibuvTrace log)
 {
     _thread = thread;
     _log    = log;
 }