closeConnection method

Future<void> closeConnection(
  1. PooledConnection connection
)

Close a specific connection and remove it from the pool.

Implementation

Future<void> closeConnection(PooledConnection connection) async {
  final pool = _connectionPools[connection.relayUrl];
  if (pool != null) {
    pool.removeWhere((c) => c.id == connection.id);
  }

  final available = _availableConnections[connection.relayUrl];
  if (available != null) {
    available.removeWhere((c) => c.id == connection.id);
  }

  logger.log('Connection closed for relay: ${connection.relayUrl}');
}