Exemplo n.º 1
0
 /**
  * Removes a connection
  *
  * @param Connection $connection
  */
 public function removeConnection(Connection $connection)
 {
     $socket = $connection->getSocket();
     if ($socket->getResource()) {
         $index = $socket->getResourceId();
     } else {
         $index = array_search($connection, $this->connections);
     }
     if (!$index) {
         $this->log('Could not remove connection: not found', 'warning');
     }
     unset($this->connections[$index]);
     unset($this->resources[$index]);
     $this->server->notify(Server::EVENT_SOCKET_DISCONNECT, array($connection->getSocket(), $connection));
 }