This commit is contained in:
2021-03-23 19:03:48 +08:00
parent 48302c5067
commit 4c1dd409b0
3 changed files with 43 additions and 8 deletions
+6
View File
@@ -57,6 +57,12 @@ class Service extends Component
private function addService($router, $server, $service)
{
$mode = $service['mode'] ?? SWOOLE_SOCK_TCP6;
if (Snowflake::port_already($service['port'])) {
throw new Exception(sprintf('Port %s::%d is already.', $service['host'], $service['port']));
}
$this->debug(sprintf('Port %s::%d is already.', $service['host'], $service['port']));
$rpcServer = $server->addlistener($service['host'], $service['port'], $mode);
$rpcServer->set([
'open_tcp_keepalive' => true,