diff --git a/Abstracts/AsyncServer.php b/Abstracts/AsyncServer.php index 6f75122..8f02fa9 100644 --- a/Abstracts/AsyncServer.php +++ b/Abstracts/AsyncServer.php @@ -4,6 +4,7 @@ namespace Kiri\Server\Abstracts; use Exception; use Kiri\Abstracts\Component; +use Kiri\Error\StdoutLogger; use Kiri\Exception\NotFindClassException; use Kiri\Server\Config as SConfig; use Kiri\Server\Constant; @@ -81,11 +82,14 @@ class AsyncServer extends Component implements ServerInterface throw new NotFindClassException('Unknown server type ' . $config->type); } + $this->container->get(StdoutLogger::class)->println('Listen address ' . $config->host . '::' . $config->port); + $this->server = new $match($config->host, $config->port, $config->mode, $config->socket); $this->server->set($this->systemConfig($config, $daemon)); if (!isset($config->events[Constant::SHUTDOWN])) { $config->events[Constant::SHUTDOWN] = [OnServer::class, 'onShutdown']; } + $this->event($this->server, array_merge(\config('server.events', []), $config->events)); $this->container->bind(ServerInterface::class, $this->server); return $service; @@ -124,6 +128,8 @@ class AsyncServer extends Component implements ServerInterface } $port->set($this->resetSettings($config->type, $config->settings)); $this->event($port, $config->getEvents()); + + $this->container->get(StdoutLogger::class)->println('Listen address ' . $config->host . '::' . $config->port); }