From c86fdadcdec7ad59724502ca4bd50d4cc4986980 Mon Sep 17 00:00:00 2001
From: Chris Boden <cboden@gmail.com>
Date: Tue, 3 Jun 2014 22:30:40 -0400
Subject: [PATCH] Revert "Fixed a memory leak when a connection is closed the
 topics should also be removed if they are empty"

This reverts commit c089aea8ebad521795610feb36bc7a937794a88c.
---
 src/Ratchet/Wamp/TopicManager.php    | 7 ++-----
 tests/unit/Wamp/TopicManagerTest.php | 7 -------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/Ratchet/Wamp/TopicManager.php b/src/Ratchet/Wamp/TopicManager.php
index a69e315..bceee73 100644
--- a/src/Ratchet/Wamp/TopicManager.php
+++ b/src/Ratchet/Wamp/TopicManager.php
@@ -77,11 +77,8 @@ class TopicManager implements WsServerInterface, WampServerInterface {
     public function onClose(ConnectionInterface $conn) {
         $this->app->onClose($conn);
 
-        foreach ($this->topicLookup as $topic => $storage) {
-            $storage->remove($conn);
-            if (0 === $storage->count()) {
-                unset($this->topicLookup[$topic]);
-            }
+        foreach ($this->topicLookup as $topic) {
+            $topic->remove($conn);
         }
     }
 
diff --git a/tests/unit/Wamp/TopicManagerTest.php b/tests/unit/Wamp/TopicManagerTest.php
index 7439064..0c31d9a 100644
--- a/tests/unit/Wamp/TopicManagerTest.php
+++ b/tests/unit/Wamp/TopicManagerTest.php
@@ -166,19 +166,12 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
         $method = $class->getMethod('getTopic');
         $method->setAccessible(true);
 
-        $attribute = $class->getProperty('topicLookup');
-        $attribute->setAccessible(true);
-
         $topic = $method->invokeArgs($this->mngr, array($name));
 
-        $this->assertCount(1, $attribute->getValue($this->mngr));
-
         $this->mngr->onSubscribe($this->conn, $name);
         $this->mngr->onClose($this->conn);
 
         $this->assertFalse($topic->has($this->conn));
-
-        $this->assertCount(0, $attribute->getValue($this->mngr));
     }
 
     public function testOnErrorBubbles() {