Exemplo n.º 1
0
        private void StartListeningCallback(object stateObject)
        {
            var state = (ListenState)stateObject;

            try
            {
                // First we open a master pipe for incoming worker IPC connections.
                // Actual socket listening starts only when the first worker connection is accepted.
                var pipe = new UvPipe(this.Worker.Loop);
                state.OpenedHandles.Add(pipe);

                pipe.Bind(this.PipeName);
                pipe.Listen(128, this.AcceptPipeConnectionCallback, state);
                state.StartTcs?.TrySetResult(null);
            }
            catch (Exception exception)
            {
                lock (this.SyncRoot)
                {
                    this.CloseBaseSocket();
                }

                this.OnConnectionAcceptError(exception);
                state.StartTcs?.TrySetException(exception);
            }
        }
Exemplo n.º 2
0
        private void AcceptPipeConnectionCallback(UvNetworkStream server, Exception error, object stateObject)
        {
            var state = (ListenState)stateObject;

            try
            {
                var workerPipe = new UvPipe(this.Worker.Loop, true);
                state.OpenedHandles.Add(workerPipe);

                server.Accept(workerPipe);

                this.workerPipes.Add(workerPipe);
                if (this.workerPipes.Count == 1)
                {
                    // Start listening the TCP socket when we got our first worker
                    base.OnListeningStarted(state);
                }
            }
            catch (Exception exception)
            {
                lock (this.SyncRoot)
                {
                    this.CloseBaseSocket();
                }

                this.OnConnectionAcceptError(exception);
                state.StartTcs?.TrySetException(exception);
            }
        }
        private void StartListeningCallback(object stateObject)
        {
            var state = (ListenState)stateObject;

            try
            {
                var pipe = new UvPipe(this.Worker.Loop, true);
                state.OpenedHandles.Add(pipe);

                pipe.Connect(this.pipeName, this.PipeConnectCallback, state);
            }
            catch (Exception exception)
            {
                lock (this.SyncRoot)
                {
                    this.CloseBaseSocket();
                }

                this.OnConnectionAcceptError(exception);
                state.StartTcs?.TrySetException(exception);
            }
        }
Exemplo n.º 4
0
 public static extern void uv_pipe_pending_instances(UvPipe handle, int count);
Exemplo n.º 5
0
 public static extern int uv_pipe_pending_count(UvPipe handle);
Exemplo n.º 6
0
 public static extern void uv_pipe_connect(UvPipeConnectRequest req, UvPipe handle, string name, UvConnectCallback cb);
Exemplo n.º 7
0
 public static extern int uv_pipe_bind(UvPipe loop, string name);
Exemplo n.º 8
0
 public static extern int uv_pipe_init(UvLoop loop, UvPipe handle, int ipc);