addSocket method

void addSocket(
  1. UDPSocket socket
)

Registers an existing socket with this multiplexer. Used for connection migration.

Implementation

void addSocket(UDPSocket socket) {
  if (socketsByCid.containsKey(socket.cids.localCid)) {
    // This case should be handled by the caller, e.g., by closing the old socket.
    // For now, we'll just log it.
    print('Warning: CID collision detected in addSocket.');
    return;
  }
  socketsByCid[socket.cids.localCid] = socket;
}