From 728bc95d73b7ce9bc15014d1cdaf8a0a9a1783d8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 16 Jan 2019 16:50:13 +0000 Subject: [PATCH] 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 --- src/pocketmine/network/mcpe/NetworkSession.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/pocketmine/network/mcpe/NetworkSession.php b/src/pocketmine/network/mcpe/NetworkSession.php index eda42eee1..c87e7cb30 100644 --- a/src/pocketmine/network/mcpe/NetworkSession.php +++ b/src/pocketmine/network/mcpe/NetworkSession.php @@ -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;