/** * Enable socket events * @return void */ public function enable() { if ($this->enabled) { return; } if (!$this->fd) { return; } $this->enabled = true; if ($this->ev === null) { $this->ev = new \EventListener(Daemon::$process->eventBase, [$this, 'onAcceptEv'], null, \EventListener::OPT_CLOSE_ON_FREE | \EventListener::OPT_REUSEABLE, -1, $this->fd); $this->onBound(); } else { $this->ev->enable(); } }
/** * Enable socket events * @return void */ public function enable() { if ($this->enabled) { return; } if (!$this->fd) { return; } $this->enabled = true; if ($this->ev === null) { if ($this->eventLoop === null) { $this->eventLoop = EventLoop::$instance; } $this->ev = $this->eventLoop->listener([$this, 'onAcceptEv'], null, \EventListener::OPT_CLOSE_ON_FREE | \EventListener::OPT_REUSEABLE, -1, $this->fd); $this->onBound(); } else { $this->ev->enable(); } }