mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
close connection if no login packet was sent 20 seconds after the connection was established
This commit is contained in:
parent
21f106f66c
commit
e827c1ed15
1 changed files with 8 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue