update to 2.2.3 version, I am tired

fix access_token not working
fix waitMessage() not working in v2.2.2
This commit is contained in:
jerry
2021-01-30 00:06:42 +08:00
parent 61e3818563
commit 517d258d61
4 changed files with 21 additions and 9 deletions

View File

@@ -401,6 +401,14 @@ class ServerEventHandler
Console::debug("Calling Swoole \"open\" event from fd=" . $request->fd);
unset(Context::$context[Co::getCid()]);
$type = strtolower($request->header["x-client-role"] ?? $request->get["type"] ?? "");
$access_token = explode(" ", $request->header["authorization"] ?? $request->get["token"] ?? "")[1] ?? "";
if (($a = ZMConfig::get("global", "access_token")) != "") {
if ($access_token !== $a) {
$server->close($request->fd);
Console::warning("Unauthorized access_token: ".$access_token);
return;
}
}
$type_conn = ManagerGM::getTypeClassName($type);
ManagerGM::pushConnect($request->fd, $type_conn);
$conn = ManagerGM::get($request->fd);