3 ms·
"So the net result was that this optimization really resulted in an extraneous recvfrom call per request, which returned EAGAIN. What was I thinking?" That onl
by nathanappere 10y ago
"So the net result was that this optimization really resulted in an extraneous recvfrom call per request, which returned EAGAIN. What was I thinking?"
That only happens if somehow you have received data that is EXACTLY the size of the buffer you send to recvfrom. If you have read less, you know that there is no need to call it again. If your buffer is full, then odds are there is more data to read so the next call won't be useless.
I suspect you actually had an extremely small proportion of "extraneous" calls.
- spc476 10y agoFor UDP packets, requesting a read of less than a full packet will discard the rest of the packet. This does not happen for TCP packets though. Darn those leaky abstractions.