diff --git a/CHANGELOG.md b/CHANGELOG.md index c0dfb49..83a3e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - 修复风暴回显过滤 - 修复一处舰长处理 - 修复中奖记录通知 +- 修复分区监控异常 - ## v0.3.0.200410 alpha (2020-04-10) diff --git a/src/plugin/ZoneTcpClient.php b/src/plugin/ZoneTcpClient.php index e0dccf2..6885658 100644 --- a/src/plugin/ZoneTcpClient.php +++ b/src/plugin/ZoneTcpClient.php @@ -410,11 +410,11 @@ class ZoneTcpClient return self::packMsg(json_encode([ "uid" => 0, "roomid" => intval($room_id), - "protover" => 2, "platform" => "web", "clientver" => "1.10.6", + "protover" => 2, "type" => 2, - "key" => Live::getDanMuToken($room_id) + // "key" => Live::getDanMuToken($room_id) ]), 0x0007); } @@ -476,6 +476,10 @@ class ZoneTcpClient $ret = 0; $socket = self::$client->getResource(); while ($length) { + if ($length < 1 || $length > 65535) { + Log::warning("Socket error: [{$ret}] [{$length}]" . PHP_EOL); + throw new Exception("Connection failure"); + } $cnt = 0; $r = array($socket); $w = NULL; @@ -489,7 +493,7 @@ class ZoneTcpClient } $ret = socket_recv($socket, $buffer, $length, 0); if ($ret < 1) { - print_r("Socket error: [{$ret}] [{$length}]" . PHP_EOL); + Log::warning("Socket error: [{$ret}] [{$length}]" . PHP_EOL); throw new Exception("Connection failure"); } $data .= $buffer;