INNER CODE UNIT · C++
tries
evanbowman/BPCore-Engine · source/BPCoreEngine.cpp:179
int tries = 5000; // arbitrary number
while (not platform->network_peer().send_message(packet)) {
if (tries == 0 or not platform->network_peer().is_connected()) {
return;
}
--tries;
}
// Make sure that we give the packet a chance to be written, before
// cutting the connection. This sleep duration is quite generous, in
// practice, all packets should be written after a frame or two, in the
// worst case.
platform->sleep(10);
platform->network_peer().disconnect();
}
}