Hi, This is because there is no way for libuv to tell if there is a data on that socket without polling the kernel again. We try to avoid it by all means.
If libuv reads less than buf.len data - it knows that there is no more pending data for sure. Cheers, Fedor. On Sun, Apr 20, 2014 at 8:06 PM, Iñaki Baz Castillo <[email protected]> wrote: > Hi, > > Running a TCP server, whenuv_alloc_cb is called I pass a uv_buf_t with > len = 20 bytes. The data received is exactly 20 bytes. > > In this case, and just in this case, after uv_read_cb libuv makes a > new call to uv_alloc_cb followed by a call to uv_read_cb with len = 0. > > Why? It does not make sense IMHO (and it is 100% useless). > > > -- > Iñaki Baz Castillo > <[email protected]> > > -- > 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. > -- 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.
