diff options
author | pjd <pjd@FreeBSD.org> | 2013-12-15 22:58:09 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2013-12-15 22:58:09 +0000 |
commit | d2d5bec62ca1a0000a3d686837388bc93c1587b0 (patch) | |
tree | 667109fec4abeb318fdf15525f4363f4641ef591 /lib/libnv/msgio.c | |
parent | 8f9b4c6a1e9be0e98ffdf5ee87683de092014b89 (diff) | |
download | FreeBSD-src-d2d5bec62ca1a0000a3d686837388bc93c1587b0.zip FreeBSD-src-d2d5bec62ca1a0000a3d686837388bc93c1587b0.tar.gz |
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
Diffstat (limited to 'lib/libnv/msgio.c')
-rw-r--r-- | lib/libnv/msgio.c | 24 |
1 files changed, 0 insertions, 24 deletions
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) { |