Browse Source

feat: add `--disable-http` option

master
Dnomd343 2 years ago
parent
commit
aa9f24818b
  1. 10
      kms.php

10
kms.php

@ -79,6 +79,12 @@ function load_params(): void {
logging::$logLevel = logging::DEBUG; logging::$logLevel = logging::DEBUG;
} }
global $ENABLE_HTTP;
if (in_array('--disable-http', $argv)) { // disable http service
logging::warning('Disable http service');
$ENABLE_HTTP = false;
}
global $KMS_PORT; global $KMS_PORT;
$KMS_PORT = intval(get_param('--kms-port', strval($KMS_PORT))); $KMS_PORT = intval(get_param('--kms-port', strval($KMS_PORT)));
if ($KMS_PORT < 1 || $KMS_PORT > 65535) { // 1 ~ 65535 if ($KMS_PORT < 1 || $KMS_PORT > 65535) { // 1 ~ 65535
@ -121,7 +127,7 @@ function exit_process(): void { // kill sub processes
global $ENABLE_HTTP; global $ENABLE_HTTP;
global $NGINX, $PHP_FPM, $VLMCSD; global $NGINX, $PHP_FPM, $VLMCSD;
if ($ENABLE_HTTP) { if ($ENABLE_HTTP) {
subExit($NGINX, $PHP_FPM, $VLMCSD); // with http server subExit($NGINX, $PHP_FPM, $VLMCSD); // with http service
} else { } else {
subExit($VLMCSD); subExit($VLMCSD);
} }
@ -161,7 +167,7 @@ while (true) { // start daemon
for ($i = 0; $i < 500; $i++) { // sleep 5s for ($i = 0; $i < 500; $i++) { // sleep 5s
msDelay(10); // return main loop every 10ms msDelay(10); // return main loop every 10ms
} }
if ($ENABLE_HTTP) { // with http server if ($ENABLE_HTTP) { // with http service
daemon($NGINX); daemon($NGINX);
daemon($PHP_FPM); daemon($PHP_FPM);
} }

Loading…
Cancel
Save