PHPPM\React\Server::shutdown PHP Method

shutdown() public method

public shutdown ( )
    public function shutdown()
    {
        $this->loop->removeStream($this->master);
        fclose($this->master);
        $this->removeAllListeners();
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Handles termination signals, so we can gracefully stop all servers.
  */
 public function shutdown()
 {
     if ($this->inShutdown) {
         return;
     }
     $this->inShutdown = true;
     //this method is also called during startup when something crashed, so
     //make sure we don't operate on nulls.
     $this->output->writeln('<error>Termination received, exiting.</error>');
     if ($this->controller) {
         @$this->controller->shutdown();
     }
     if ($this->web) {
         @$this->web->shutdown();
     }
     if ($this->loop) {
         $this->loop->tick();
         $this->loop->stop();
     }
     foreach ($this->slaves as $slave) {
         if (is_resource($slave['process'])) {
             proc_terminate($slave['process']);
         }
         if ($slave['pid']) {
             //make sure its dead
             posix_kill($slave['pid'], SIGKILL);
         }
     }
     exit;
 }
All Usage Examples Of PHPPM\React\Server::shutdown