addConnections method
Add connections from a list of addresses
Implementation
Future<List<PeerConnection>> addConnections(List<String> addresses, int port) async {
final connections = <PeerConnection>[];
final errors = <String>[];
for (final address in addresses) {
try {
final connection = await addConnection(address, port);
connections.add(connection);
} catch (e) {
errors.add('$address: $e');
}
}
if (errors.isNotEmpty) {
logger.warning('Failed to connect to some peers: ${errors.join(', ')}');
}
return connections;
}