Delete all connections of con_type but the one specified.
547181
async def _trim_old_connections(
        new_name: str, con_type: CONNECTION_TYPES) -> Tuple[bool, str]:
    
    existing_cons = await connections(for_type=con_type)
    not_us = [c['name'] for c in existing_cons if c['name'] != new_name]
    ok = True
    res = []
    for c in not_us:
        this_ok, remove_res = await remove(name=c)
        ok = ok and this_ok
        if not this_ok:
            # This is not a failure case for connection, and indeed the new
            # connection is already established, so just warn about it
            log.warning("Could not remove wifi connection {}: {}"
                        .format(c, remove_res))
            res.append(remove_res)
        else:
            log.debug("Removed old wifi connection {}".format(c))
    return ok, ';'.join(res)
151864
async def teardown_conn(self, context):
        """"""

        client_id = context.user_data

        self._logger.info("Tearing down client connection: %s", client_id)
        if client_id not in self.clients:
            self._logger.warning("client_id %s did not exist in teardown_conn", client_id)
        else:
            del self.clients[client_id]
312203
private void destroyConnLinks() {
        synchronized (inUse) {
            int numlinks = inUse.size();
            for (int i = 0; i < numlinks; i++) {
                inUse.removeFirst().destroy(null);
            }
        }
    }
559936
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.items():
            if assoc.expiresIn == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
1041732
void dropNonPreferredConnections()
    {
        final String methodName = "dropNonPreferredConnections";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName);
        }

        // If we are connected to a non preferred then we will NEVER be connect to a preferred as 
        // well, there is no mixing of connection types.
        if (!_connectedToPreferred)
        {
            closeConnections();
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(TRACE, methodName);
        }
    }
1289060
def delete(self):
        

        es = connections.get_connection(self._using)

        return AttrDict(
            es.delete_by_query(
                index=self._index,
                body=self.to_dict(),
                **self._params
            )
        )
574808
protected void removeConnection(FTPConnection con) throws IOException {
        synchronized(listeners) {
            for(IFTPListener l : listeners) {
                l.onDisconnected(con);
            }
        }
        synchronized(connections) {
            connections.remove(con);
        }
    }
1301550
@VisibleForTesting
    @Synchronized
    public void pruneUnusedConnections() {
        for (List<Connection> connections : connectionMap.values()) {
            for (Iterator<Connection> iterator = connections.iterator(); iterator.hasNext();) {
                Connection connection = iterator.next();
                if (isUnused(connection)) {
                    connection.getFlowHandler().close();
                    iterator.remove();
                }
            }
        }
    }
887997
function (conn, cb) {

      // TODO: disconnect here
      if (typeof conn == 'function') {
        cb = conn;
        conn = null;
      }
      if (!conn) {
        connections = {};
        return cb();
      }
      if(!connections[conn]) return cb();
      delete connections[conn];
      cb();
    }
998386
private function cleanupSlaveConnections()
    {
        foreach ($this->config['database']['connections'] as $name => $connection) {
            if (count($connection['slaves']) <= 0) {
                unset($this->config['database']['connections'][$name]['slaves']);
            }
        }
    }
394778
def delete_connection(self, name):
        
        name = quote(name, '')
        path = Client.urls['connections_by_name'] % name
        self._call(path, 'DELETE')
        return True
955974
function stripConnectionHeaders(req) {
  var conn = req.getHeader("connection");
  if (typeof(conn) === 'undefined' || conn === null)
    return;

  conn.split(/\s+/g).forEach(function(header) {
    if (header.length === 0)
      return;
    req.removeHeader(header);
  });
  req.removeHeader("connection");
}
1033523
public void removeAll() {
    LOGGER.debug("Removing {} reverse connections from subscription manager", reverse.size());
    Iterator<HomekitClientConnection> i = reverse.keySet().iterator();
    while (i.hasNext()) {
      HomekitClientConnection connection = i.next();
      LOGGER.debug("Removing connection {}", connection.hashCode());
      removeConnection(connection);
    }
    LOGGER.debug("Subscription sizes are {} and {}", reverse.size(), subscriptions.size());
  }
122719
def cleanup(self):
        """"""
        for item in self.server_map:
            self.member_del(item, reconfig=False)
        self.server_map.clear()
701724
function(connection) {
      var t = this;
      log.info('removeConnection', 'Conn_' + connection.id);
      connection.disconnect('connection_removed');
      t.connections.remove(connection);
      t.trigger('connection:remove', connection);
    }
255773
def _cleanup(self) -> None:
        """"""
        if self._cleanup_handle:
            self._cleanup_handle.cancel()

        now = self._loop.time()
        timeout = self._keepalive_timeout

        if self._conns:
            connections = {}
            deadline = now - timeout
            for key, conns in self._conns.items():
                alive = []
                for proto, use_time in conns:
                    if proto.is_connected():
                        if use_time - deadline < 0:
                            transport = proto.transport
                            proto.close()
                            if (key.is_ssl and
                                    not self._cleanup_closed_disabled):
                                self._cleanup_closed_transports.append(
                                    transport)
                        else:
                            alive.append((proto, use_time))

                if alive:
                    connections[key] = alive

            self._conns = connections

        if self._conns:
            self._cleanup_handle = helpers.weakref_handle(
                self, '_cleanup', timeout, self._loop)
1012233
def clear(self):
        
        with self._conn:
            self._conn.execute('DELETE FROM results')
            self._conn.execute('DELETE FROM work_items')