This commit is contained in:
2020-09-18 20:41:18 +08:00
parent ea7c2afa40
commit a762e67dab
+5 -5
View File
@@ -291,16 +291,16 @@ class Server extends Application
if ($this->isUse($config['port'])) {
return $this->error_stop($config['host'], $config['port']);
}
if ($class instanceof Websocket) {
$this->onLoadWebsocketHandler();
} else if ($class instanceof Http) {
$this->onLoadHttpHandler();
}
$this->baseServer = new $class($config['host'], $config['port'], SWOOLE_PROCESS, $config['mode']);
$settings['daemonize'] = $this->daemon;
if (!isset($settings['pid_file'])) {
$settings['pid_file'] = APP_PATH . 'storage/server.pid';
}
if ($this->baseServer instanceof Websocket) {
$this->onLoadWebsocketHandler();
} else if ($this->baseServer instanceof Http) {
$this->onLoadHttpHandler();
}
$this->baseServer->set($settings);
} else {
$newListener = $this->baseServer->addlistener($config['host'], $config['port'], $config['mode']);