|
|
@ -208,12 +208,17 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { |
|
|
|
ssize_t nread; |
|
|
|
uv_buf_t buf; |
|
|
|
int flags; |
|
|
|
int count; |
|
|
|
|
|
|
|
assert(handle->recv_cb != NULL); |
|
|
|
assert(handle->alloc_cb != NULL); |
|
|
|
|
|
|
|
/* Prevent loop starvation when the data comes in as fast as (or faster than)
|
|
|
|
* we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O. |
|
|
|
*/ |
|
|
|
count = 32; |
|
|
|
|
|
|
|
do { |
|
|
|
/* FIXME: hoist alloc_cb out the loop but for now follow uv__read() */ |
|
|
|
buf = handle->alloc_cb((uv_handle_t*)handle, 64 * 1024); |
|
|
|
assert(buf.len > 0); |
|
|
|
assert(buf.base != NULL); |
|
|
@ -254,6 +259,7 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { |
|
|
|
} |
|
|
|
/* recv_cb callback may decide to pause or close the handle */ |
|
|
|
while (nread != -1 |
|
|
|
&& count-- > 0 |
|
|
|
&& handle->fd != -1 |
|
|
|
&& handle->recv_cb != NULL); |
|
|
|
} |
|
|
|