On 4/16/14 6:50 PM, Iñaki Baz Castillo wrote:
2014-04-16 18:35 GMT+02:00 Fedor Indutny <[email protected]>:
Hello!

Yes, it is expected behavior. Have you expected anything else?

Well, it is a good behavior IMHO, but I expected ENOBUFS error in the
uv_read_cb (anyhow I strongly prefer the existing behavior).


alloc_cb and read_cb go in pairs. For one alloc_cb there will be only one read_cb. If you pass a small buffer, there is probably queued data in the kernel, so the socket will still be readable and alloc_cb will be called again, in level-triggered i/o fashion.

ENOUBUFS shall only happen if you set 0 as the buffer length in alloc_cb.

BTW, would ENOBUFS error happen in uv_read_cb if the allocated buffer
is smaller than the received data in UDP or Unix Socket?


No. On UDP the recv_cb has a flags parameter which will have UV_UDP_PARTIAL flag set. Note that the remaining part of the message was discarded by the OS. For unix sockets you'll just get a chuck of the data, since they are stream based.


Cheers,

--
Saúl Ibarra Corretgé
http://bettercallsaghul.com

--
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to