mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-22 08:05:34 +08:00
update to version 2.3.2 (build 395)
fix overflow bug
This commit is contained in:
@@ -29,25 +29,15 @@ trait CQAPI
|
|||||||
public function processWebsocketAPI($connection, $reply, $function = false) {
|
public function processWebsocketAPI($connection, $reply, $function = false) {
|
||||||
$api_id = ZMAtomic::get("wait_msg_id")->add(1);
|
$api_id = ZMAtomic::get("wait_msg_id")->add(1);
|
||||||
$reply["echo"] = $api_id;
|
$reply["echo"] = $api_id;
|
||||||
SpinLock::lock("wait_api");
|
|
||||||
$r = LightCacheInside::get("wait_api", "wait_api");
|
|
||||||
$r[$api_id] = [
|
|
||||||
"data" => $reply,
|
|
||||||
"time" => microtime(true),
|
|
||||||
"self_id" => $connection->getOption("connect_id"),
|
|
||||||
"echo" => $api_id
|
|
||||||
];
|
|
||||||
LightCacheInside::set("wait_api", "wait_api", $r);
|
|
||||||
SpinLock::unlock("wait_api");
|
|
||||||
if (server()->push($connection->getFd(), json_encode($reply))) {
|
if (server()->push($connection->getFd(), json_encode($reply))) {
|
||||||
if ($function === true) {
|
if ($function === true) {
|
||||||
return CoMessage::yieldByWS($r[$api_id], ["echo"], 60);
|
$obj = [
|
||||||
} else {
|
"data" => $reply,
|
||||||
SpinLock::lock("wait_api");
|
"time" => microtime(true),
|
||||||
$r = LightCacheInside::get("wait_api", "wait_api");
|
"self_id" => $connection->getOption("connect_id"),
|
||||||
unset($r[$api_id]);
|
"echo" => $api_id
|
||||||
LightCacheInside::set("wait_api", "wait_api", $r);
|
];
|
||||||
SpinLock::unlock("wait_api");
|
return CoMessage::yieldByWS($obj, ["echo"], 60);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use ZM\Utils\DataProvider;
|
|||||||
|
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
const VERSION_ID = 394;
|
const VERSION_ID = 395;
|
||||||
const VERSION = "2.3.2";
|
const VERSION = "2.3.2";
|
||||||
|
|
||||||
public function __construct(string $name = 'UNKNOWN') {
|
public function __construct(string $name = 'UNKNOWN') {
|
||||||
|
|||||||
Reference in New Issue
Block a user