mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
NetworkSession: remove premature GC optimization
The only cyclic references here are both destroyed during normal collection directly (net interface removes from sessions array, player destroys its session reference), so there's no need to destroy them again here. This just causes a giant swathe of potential crashes for no real benefit. close #2669
This commit is contained in:
parent
acdd0fec5f
commit
728bc95d73
@ -342,7 +342,6 @@ class NetworkSession{
|
||||
}
|
||||
|
||||
$this->interface->close($this, $notify ? $reason : "");
|
||||
$this->disconnectCleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,18 +354,9 @@ class NetworkSession{
|
||||
if($this->connected){
|
||||
$this->connected = false;
|
||||
$this->player->close($this->player->getLeaveMessage(), $reason);
|
||||
$this->disconnectCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
private function disconnectCleanup() : void{
|
||||
$this->handler = null;
|
||||
$this->interface = null;
|
||||
$this->player = null;
|
||||
$this->sendBuffer = null;
|
||||
$this->compressedQueue = null;
|
||||
}
|
||||
|
||||
public function enableEncryption(string $encryptionKey, string $handshakeJwt) : void{
|
||||
$pk = new ServerToClientHandshakePacket();
|
||||
$pk->jwt = $handshakeJwt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user