drop only successfully sent packets post sendmmsg

sendmmsg returns with number of packets sent which can
be less than number of packets requested to be sent. Do
not flush entire write queue and use the returned info
to partially clear the write queue.

Refs: https://github.com/libuv/libuv/issues/3129 (fixes one issue listed)
PR-URL: https://github.com/libuv/libuv/pull/3265
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Supragya Raj 2021-08-05 15:27:26 +05:30 committed by Santiago Gimeno
parent 04289fa326
commit 6530ea2ff2
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -375,8 +375,11 @@ write_queue_drain:
return;
}
/* Safety: npkts known to be >0 below. Hence cast from ssize_t
* to size_t safe.
*/
for (i = 0, q = QUEUE_HEAD(&handle->write_queue);
i < pkts && q != &handle->write_queue;
i < (size_t)npkts && q != &handle->write_queue;
++i, q = QUEUE_HEAD(&handle->write_queue)) {
assert(q != NULL);
req = QUEUE_DATA(q, uv_udp_send_t, queue);