mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 07:35:34 +08:00
update to 2.5.0-b3 (build 410)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user