Revert "Fixed a memory leak when a connection is closed the topics should also be removed if they are empty"

This reverts commit c089aea8eb.
This commit is contained in:
Chris Boden 2014-06-03 22:30:40 -04:00
parent e1dba72254
commit c86fdadcde
2 changed files with 2 additions and 12 deletions

View File

@ -77,11 +77,8 @@ class TopicManager implements WsServerInterface, WampServerInterface {
public function onClose(ConnectionInterface $conn) { public function onClose(ConnectionInterface $conn) {
$this->app->onClose($conn); $this->app->onClose($conn);
foreach ($this->topicLookup as $topic => $storage) { foreach ($this->topicLookup as $topic) {
$storage->remove($conn); $topic->remove($conn);
if (0 === $storage->count()) {
unset($this->topicLookup[$topic]);
}
} }
} }

View File

@ -166,19 +166,12 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$method = $class->getMethod('getTopic'); $method = $class->getMethod('getTopic');
$method->setAccessible(true); $method->setAccessible(true);
$attribute = $class->getProperty('topicLookup');
$attribute->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name)); $topic = $method->invokeArgs($this->mngr, array($name));
$this->assertCount(1, $attribute->getValue($this->mngr));
$this->mngr->onSubscribe($this->conn, $name); $this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onClose($this->conn); $this->mngr->onClose($this->conn);
$this->assertFalse($topic->has($this->conn)); $this->assertFalse($topic->has($this->conn));
$this->assertCount(0, $attribute->getValue($this->mngr));
} }
public function testOnErrorBubbles() { public function testOnErrorBubbles() {