Limit scheduling of flush tasks in SCTP transport

This commit is contained in:
Paul-Louis Ageneau
2021-03-05 18:50:10 +01:00
parent faf3158609
commit bd3df48c0b
3 changed files with 48 additions and 28 deletions

View File

@ -127,8 +127,12 @@ size_t benchmark(milliseconds duration) {
openTime = steady_clock::now();
cout << "DataChannel open, sending data..." << endl;
while (dc1->bufferedAmount() == 0) {
dc1->send(messageData);
try {
while (dc1->bufferedAmount() == 0) {
dc1->send(messageData);
}
} catch (const std::exception &e) {
std::cout << "Send failed: " << e.what() << std::endl;
}
// When sent data is buffered in the DataChannel,
@ -141,8 +145,12 @@ size_t benchmark(milliseconds duration) {
return;
// Continue sending
while (dc1->bufferedAmount() == 0) {
dc1->send(messageData);
try {
while (dc1->isOpen() && dc1->bufferedAmount() == 0) {
dc1->send(messageData);
}
} catch (const std::exception &e) {
std::cout << "Send failed: " << e.what() << std::endl;
}
});