close method
Stops the hub and closes every connection.
Implementation
Future<void> close() async {
_ttlTimer?.cancel();
_ttlTimer = null;
for (final pending in _pending.values.toList(growable: false)) {
pending.deadline.cancel();
await pending.socket.close();
}
_pending.clear();
for (final connection in _connections.values.toList(growable: false)) {
await connection.socket.close();
}
_connections.clear();
_routing.clear();
_registry.dispose();
await _server.close(force: true);
logger.info('Coordination hub stopped');
}