/** * {@inheritdoc} */ public function start(ServerContextInterface $context, RequestHandlerInterface $requestHandler) { $this->server = new \swoole_http_server($context->getListenAddress(), $context->getListenPort(), \SWOOLE_BASE); if (null !== $this->serverOptions) { $this->server->set($this->serverOptions->getOptions()); } $this->server->on('request', $this->createRequestHandler($requestHandler)); $this->server->start(); }
public function testPositive() { $opt = new SwooleServerOptions(array('chroot' => 'foo', 'daemonize' => true, 'backlog' => 10, 'cpu_affinity_ignore' => array(1 => 99))); $opt->setOption('user', 'bar'); $this->assertSame(array('chroot' => 'foo', 'daemonize' => true, 'backlog' => 10, 'cpu_affinity_ignore' => array(1 => 99), 'user' => 'bar'), $opt->getOptions()); }