src/ProcessSlave.php
private function doConnect()
    {
        $connector = new UnixConnector($this->loop);
        $unixSocket = $this->getControllerSocketPath(false);

        $connector->connect($unixSocket)->done(
            function ($controller) {
                $this->controller = $controller;

                $this->loop->addSignal(SIGTERM, [$this, 'shutdown']);
                $this->loop->addSignal(SIGINT, [$this, 'shutdown']);
                register_shutdown_function([$this, 'prepareShutdown']);

                $this->bindProcessMessage($this->controller);
                $this->controller->on('close', [$this, 'shutdown']);

                // port is the slave identifier
                $port = $this->config['port'];
                $socketPath = $this->getSlaveSocketPath($port, true);
                $this->server = new UnixServer($socketPath, $this->loop);

                $httpServer = new HttpServer([$this, 'onRequest']);
                $httpServer->listen($this->server);

                $this->sendMessage($this->controller, 'register', ['pid' => getmypid(), 'port' => $port]);
            }
        );
    }
private function doConnect()
    {
        $connector = new UnixConnector($this->loop);
        $unixSocket = $this->getControllerSocketPath(false);

        $connector->connect($unixSocket)->done(
            function ($controller) {
                $this->controller = $controller;

                $this->loop->addSignal(SIGTERM, [$this, 'shutdown']);
                $this->loop->addSignal(SIGINT, [$this, 'shutdown']);
                register_shutdown_function([$this, 'prepareShutdown']);

                $this->bindProcessMessage($this->controller);
                $this->controller->on('close', [$this, 'shutdown']);

                // port is the slave identifier
                $port = $this->config['port'];
                $socketPath = $this->getSlaveSocketPath($port, true);
                $this->server = new UnixServer($socketPath, $this->loop);

                $httpServer = new HttpServer([$this, 'onRequest']);
                $httpServer->listen($this->server);

                $this->sendMessage($this->controller, 'register', ['pid' => getmypid(), 'port' => $port]);
            }
        );
    }
private function doConnect ( ) { $ connector = new UnixConnector ( $ this -> loop ) ; $ unixSocket = $ this -> getControllerSocketPath ( false ) ; $ connector -> connect ( $ unixSocket ) -> done ( function ( $ controller ) { $ this -> controller = $ controller ; $ this -> loop -> addSignal ( SIGTERM , [ $ this , 'shutdown' ] ) ; $ this -> loop -> addSignal ( SIGINT , [ $ this , 'shutdown' ] ) ; register_shutdown_function ( [ $ this , 'prepareShutdown' ] ) ; $ this -> bindProcessMessage ( $ this -> controller ) ; $ this -> controller -> on ( 'close' , [ $ this , 'shutdown' ] ) ; // port is the slave identifier $ port = $ this -> config [ 'port' ] ; $ socketPath = $ this -> getSlaveSocketPath ( $ port , true ) ; $ this -> server = new UnixServer ( $ socketPath , $ this -> loop ) ; $ httpServer = new HttpServer ( [ $ this , 'onRequest' ] ) ; $ httpServer -> listen ( $ this -> server ) ; $ this -> sendMessage ( $ this -> controller , 'register' , [ 'pid' => getmypid ( ) , 'port' => $ port ] ) ; } ) ; }
Attempt a connection to the unix socket.

@throws \RuntimeException
Attempt a connection to the unix socket .