From 093bf3ddeeca1b52aa4dc7cab07c45970c680de8 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 23 Apr 2013 11:44:58 +0200 Subject: [PATCH] Query now checks for the last token when changed (30-sec change) --- src/network/Query.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/Query.php b/src/network/Query.php index df9fa3b4a..a5be6d2ef 100644 --- a/src/network/Query.php +++ b/src/network/Query.php @@ -31,7 +31,7 @@ Source: http://wiki.unrealadmin.org/UT3_query_protocol */ class Query{ - private $socket, $workers, $threads, $server, $token, $longData, $timeout; + private $socket, $workers, $threads, $server, $lastToken, $token, $longData, $timeout; public function __construct(){ $this->workers = array(); @@ -46,6 +46,7 @@ class Query{ $this->server->addHandler("server.unknownpacket", array($this, "packetHandler"), 50); $this->server->schedule(20 * 30, array($this, "regenerateToken"), array(), true); $this->regenerateToken(); + $this->lastToken = $this->token; $this->regenerateInfo(); console("[INFO] Query running on $addr:$port"); } @@ -89,6 +90,7 @@ class Query{ } public function regenerateToken(){ + $this->lastToken = $this->token; $this->token = Utils::readInt("\x00".Utils::getRandomBytes(3, false)); } @@ -112,7 +114,7 @@ class Query{ break; case 0: //Stat $token = Utils::readInt(substr($payload, 0, 4)); - if($token !== $this->token){ + if($token !== $this->token and $token !== $this->lastToken){ break; } if(strlen($payload) === 8){