From c8c9fe1c747d6955686c1cec21bda53c2e5592b8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 5 Jun 2012 15:42:17 +0200 Subject: [PATCH] unix: move memset out of recvmsg inner loop --- src/unix/udp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/unix/udp.c b/src/unix/udp.c index 3c784962..9f87060a 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -210,14 +210,15 @@ static void uv__udp_recvmsg(uv_loop_t* loop, uv__io_t* w, int revents) { */ count = 32; + memset(&h, 0, sizeof(h)); + h.msg_name = &peer; + do { buf = handle->alloc_cb((uv_handle_t*)handle, 64 * 1024); assert(buf.len > 0); assert(buf.base != NULL); - memset(&h, 0, sizeof h); - h.msg_name = &peer; - h.msg_namelen = sizeof peer; + h.msg_namelen = sizeof(peer); h.msg_iov = (struct iovec*)&buf; h.msg_iovlen = 1;