From d2d5bec62ca1a0000a3d686837388bc93c1587b0 Mon Sep 17 00:00:00 2001 From: pjd Date: Sun, 15 Dec 2013 22:58:09 +0000 Subject: MFp4 @1189139: Get rid of the msg_peek() function, which has a problem. If there was less data in the socket buffer than requested by the caller, the function would busy loop, as select(2) will always return immediately. We can just receive nvlhdr now, because some time ago we splitted receive of data from the receive of descriptors. MFC after: 1 week --- lib/libnv/msgio.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'lib/libnv/msgio.c') diff --git a/lib/libnv/msgio.c b/lib/libnv/msgio.c index a37d1cd..0a0bd7f 100644 --- a/lib/libnv/msgio.c +++ b/lib/libnv/msgio.c @@ -113,30 +113,6 @@ fd_wait(int fd, bool doread) NULL, NULL); } -int -msg_peek(int sock, void *buf, size_t size) -{ - ssize_t done; - - PJDLOG_ASSERT(sock >= 0); - PJDLOG_ASSERT(size > 0); - - do { - fd_wait(sock, true); - done = recv(sock, buf, size, MSG_PEEK | MSG_WAITALL); - if (done == -1) { - if (errno == EAGAIN || errno == EINTR) - continue; - return (-1); - } else if (done == 0) { - errno = ENOTCONN; - return (-1); - } - } while (done != (ssize_t)size); - - return (0); -} - static int msg_recv(int sock, struct msghdr *msg) { -- cgit v1.1