/* allows to disconnect all those already
unnecessary 'data', 'sent' and 'error' handlers.
199418
function _e2p(emitter, event, options) {
  let p = e2p(emitter, event, options);

  return p.then(() => {
    p.cancel();
    return p;
  })
  .catch(err => {
    p.cancel();
    throw err;
  });
}
278018
function cleanUp() {
    if (done) return
    done = true

    wsConn.removeListener("message", onMessage)
    wsConn.removeListener("close",   onClose)
    wsConn.removeListener("error",   onError)
  }
653763
def disconnect_signals(self):
        
        for task in self:
            try:
                dispatcher.disconnect(self.on_ok, signal=task.S_OK, sender=task)
            except dispatcher.errors.DispatcherKeyError as exc:
                logger.debug(str(exc))
146510
function disconnect(conn, socket, err) {
  //console.dir('disconnect');

  // clean monitor listeners
  if(this._monitor[conn.id]) {
    this.removeListener('monitor', this._monitor[conn.id]);
    delete this._monitor[conn.id];
  }

  this._state.removeConnection(conn);
}
675166
protected function cleanupHandles()
    {
        if ($diff = max(0, count($this->handles) - $this->maxHandles)) {
            for ($i = count($this->handles) - 1; $i > 0 && $diff > 0; $i--) {
                if (!count($this->handles[$i])) {
                    unset($this->handles[$i]);
                    $diff--;
                }
            }
            $this->handles = array_values($this->handles);
        }
    }
998386
private function cleanupSlaveConnections()
    {
        foreach ($this->config['database']['connections'] as $name => $connection) {
            if (count($connection['slaves']) <= 0) {
                unset($this->config['database']['connections'][$name]['slaves']);
            }
        }
    }
967746
def disconnect(self):
        """"""
        # here we just request the disconnection
        # later in _handle_eio_disconnect we invoke the disconnect handler
        for n in self.namespaces:
            self._send_packet(packet.Packet(packet.DISCONNECT, namespace=n))
        self._send_packet(packet.Packet(
            packet.DISCONNECT, namespace='/'))
        self.eio.disconnect(abort=True)
699306
public void disconnect() {
        if (disconnected.compareAndSet(false, true)) {
            log.debug("Disconnect - id: {}", id);
            if (connections != null && !connections.isEmpty()) {
                log.debug("Closing {} scope connections", connections.size());
                // close all connections held to Red5 by client
                for (IConnection con : getConnections()) {
                    try {
                        con.close();
                    } catch (Exception e) {
                        // closing a connection calls into application code, so exception possible
                        log.error("Unexpected exception closing connection {}", e);
                    }
                }
            } else {
                log.debug("Connection map is empty or null");
            }
            // unregister client
            removeInstance();
        }
    }
916730
function (threadId) {
        Multiplexer.connections[threadId] && Multiplexer.connections[threadId].release();
        delete Multiplexer.connections[threadId];
    }
486601
final void closeAndRemoveAllDatabaseHandles() {
        for (Database databaseHandle : this.databaseHandles) {
            try {
                databaseHandle.close();
            } catch (EnvironmentFailureException | IllegalStateException ex) {
                LOGGER.log(Level.SEVERE,
                        "Error closing databases", ex);
            }
        }
        this.databaseHandles.clear();
    }
131588
def disconnect(self):
        
        all_conns = chain(
            self._available_connections.values(),
            self._in_use_connections.values(),
        )

        for node_connections in all_conns:
            for connection in node_connections:
                connection.disconnect()
1237500
public static function shutdown_handler($errors = false, $handled = false)
    {
        if ($handled) {
            self::flush();
        }

        if ($errors === true && ($error = error_get_last()) && !$handled) {
            self::error_handler($error["type"], $error["message"], $error["file"], $error["line"]);
        }

        if (!$handled) {
            self::flush();
        }

        if (session_id() != '') {
            session_write_close();
        }

        exit;
    }
581968
def disconnect_all(self, message=""):
        """"""
        with self.mutex:
            for conn in self.connections:
                conn.disconnect(message)
371039
function closeExtension(done) {
            var extension = self.extension;

            if (extension && !extension.closed) {
                extension.removeListener('error', handlers.relayError);

                extension.close(done);
            } else {
                done(null);
            }
        }
1022392
function cleanConnection()
    {
        $now = time();
        foreach($this->connections as $client_id => $conn)
        {
            if($conn['time'] < $now - $this->heart_time)
            {
                $this->log("connection[$client_id] timeout.", 'CLOSE');
                $this->close($client_id);
            }
        }
        $this->log('clean connections');
    }
919395
function clean(done) {
	var del = require('del');
	del(cfg.destination).then(function () {
		if (typeof done === 'function') done();
		else process.exit();
	});
}
159180
function Disconnect()
	{
		$this->handler->Log(DBH_LOG_INFO, "Closing Connection...");

		if ($this->dbopen)
		{
			$this->adapter->Close();
			$this->dbopen = false;
			$this->handler->Log(DBH_LOG_INFO, "Connection closed");
		}
		else
		{
			$this->handler->Log(DBH_LOG_WARNING, "Connection Already Closed");
		}
	}