close method

void close()

Closes the multiplexer and all associated sockets.

Implementation

void close() {
  // Create a copy of the list of sockets to avoid concurrent modification
  final socketsToClose = List<UDPSocket>.from(socketsByCid.values);
  for (final s in socketsToClose) {
    s.close();
  }
  socketsByCid.clear();
  socket.close();
  _connectionsController.close();
}