From 76e5099fd4644aca683a48194806020042482ef7 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Mon, 6 Jul 2020 16:59:41 +0100 Subject: [PATCH 1/2] Correct recvmmsg If an error occurs after at least one message has been received, the call succeeds, and returns the number of messages received. The error code is expected to be returned on a subsequent call to recvmmsg(). --- libs/exasock/socket/recv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/exasock/socket/recv.c b/libs/exasock/socket/recv.c index 568d389..8ccb36d 100644 --- a/libs/exasock/socket/recv.c +++ b/libs/exasock/socket/recv.c @@ -1070,10 +1070,8 @@ recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, flags & ~MSG_WAITFORONE); if (ret == -1) { - /* no more data, and user wants non-blocking behaviour */ - if (errno == EAGAIN - && (flags & MSG_WAITFORONE) - && (i > 0)) + /* subsquent calls will return the error */ + if (i > 0) ret = i; goto out; } From da832a8366eafce8dfcb820d3c7ebf45ee471680 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Mon, 6 Jul 2020 19:00:48 +0100 Subject: [PATCH 2/2] Update recv.c --- libs/exasock/socket/recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/exasock/socket/recv.c b/libs/exasock/socket/recv.c index 8ccb36d..3ccf395 100644 --- a/libs/exasock/socket/recv.c +++ b/libs/exasock/socket/recv.c @@ -1070,7 +1070,7 @@ recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, flags & ~MSG_WAITFORONE); if (ret == -1) { - /* subsquent calls will return the error */ + /* subsequent calls will return the error */ if (i > 0) ret = i; goto out;