update to 2.5.0-b3 (build 410)

This commit is contained in:
crazywhalecc
2021-07-09 01:38:30 +08:00
parent c185d20a93
commit 7e0fc1528a
34 changed files with 692 additions and 157 deletions

View File

@@ -5,7 +5,9 @@ namespace ZM\Event\SwooleEvent;
use Swoole\Process;
use Swoole\WebSocket\Server;
use ZM\Annotation\Swoole\SwooleHandler;
use ZM\ConnectionManager\ManagerGM;
use ZM\Console\Console;
use ZM\Event\SwooleEvent;
@@ -16,11 +18,16 @@ use ZM\Event\SwooleEvent;
*/
class OnBeforeReload implements SwooleEvent
{
public function onCall() {
public function onCall(Server $server) {
Console::info(Console::setColor("Reloading server...", "gold"));
for ($i = 0; $i < ZM_WORKER_NUM; ++$i) {
Process::kill(zm_atomic("_#worker_".$i)->get(), SIGUSR1);
Process::kill(zm_atomic("_#worker_" . $i)->get(), SIGUSR1);
}
foreach ($server->connections as $fd) {
if (ManagerGM::get($fd) !== null) $server->disconnect($fd);
else $server->close($fd);
}
usleep(800 * 1000);
}
}