From e827c1ed1521d63104a80623b6a54eeaf69f43b4 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 7 Aug 2025 20:41:48 +0300 Subject: [PATCH] close connection if no login packet was sent 20 seconds after the connection was established --- src/Player.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 89d8a29c..0465d181 100755 --- a/src/Player.php +++ b/src/Player.php @@ -31,7 +31,7 @@ class Player{ public $loggedIn = false; public $gamemode; public $gmKickSoon = false; - public $lastBreak; + public $lastBreak, $connectionStartedAt; public $windowCnt = 2; public $windows = []; public $blocked = true; @@ -162,6 +162,7 @@ class Player{ $this->MTU = min($MTU, 1100); $this->server = ServerAPI::request(); $this->lastBreak = microtime(true); + $this->connectionStartedAt = microtime(true); $this->clientID = $clientID; $this->CID = PocketMinecraftServer::clientID($ip, $port); $this->ip = $ip; @@ -1547,6 +1548,12 @@ class Player{ return false; } $time = microtime(true); + + if($this->loggedIn === false && ($time - $this->connectionStartedAt) >= 20){ + $this->close("timeout"); + return false; + } + if($time > $this->timeout){ $this->close("timeout"); return false;