Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Events/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ public function onReadable($stream, callable $func): void
{
$count = count($this->readFds);
if ($count >= 1024) {
echo "Warning: system call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.\n";
trigger_error("System call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.", E_USER_WARNING);
} else if (DIRECTORY_SEPARATOR !== '/' && $count >= 256) {
echo "Warning: system call select exceeded the maximum number of connections 256.\n";
trigger_error("System call select exceeded the maximum number of connections 256.", E_USER_WARNING);
}
$fdKey = (int)$stream;
$this->readEvents[$fdKey] = $func;
Expand All @@ -216,9 +216,9 @@ public function onWritable($stream, callable $func): void
{
$count = count($this->writeFds);
if ($count >= 1024) {
echo "Warning: system call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.\n";
trigger_error("System call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.", E_USER_WARNING);
} else if (DIRECTORY_SEPARATOR !== '/' && $count >= 256) {
echo "Warning: system call select exceeded the maximum number of connections 256.\n";
trigger_error("System call select exceeded the maximum number of connections 256.", E_USER_WARNING);
}
$fdKey = (int)$stream;
$this->writeEvents[$fdKey] = $func;
Expand Down
10 changes: 5 additions & 5 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1265,12 +1265,12 @@ protected static function signalHandler(int $signal): void
case SIGHUP:
case SIGTSTP:
static::$gracefulStop = false;
static::stopAll();
static::stopAll(0, "received signal: $signal");
break;
// Graceful stop.
case SIGQUIT:
static::$gracefulStop = true;
static::stopAll();
static::stopAll(0, "received signal: $signal");
break;
// Reload.
case SIGUSR2:
Expand Down Expand Up @@ -1791,8 +1791,8 @@ protected static function monitorWorkersForLinux(): void
}
}

// If shutdown state and all child processes exited then master process exit.
if (static::$status === static::STATUS_SHUTDOWN && !static::getAllWorkerPids()) {
// If shutdown state and all child processes exited, then master process exit.
if (static::$status === static::STATUS_SHUTDOWN && empty(static::getAllWorkerPids())) {
static::exitAndClearAll();
}
}
Expand Down Expand Up @@ -1926,7 +1926,7 @@ public static function stopAll(int $code = 0, mixed $log = ''): void
static::$status = static::STATUS_SHUTDOWN;
// For master process.
if (DIRECTORY_SEPARATOR === '/' && static::$masterPid === posix_getpid()) {
static::log("Workerman[" . basename(static::$startFile) . "] stopping ...");
static::log("Workerman[" . basename(static::$startFile) . "] stopping, code [$code]");
$workerPidArray = static::getAllWorkerPids();
// Send stop signal to all child processes.
$sig = static::getGracefulStop() ? SIGQUIT : SIGINT;
Expand Down