From 1960937df311d115247cc8f346b4773a68afbd44 Mon Sep 17 00:00:00 2001 From: Nate Karstens Date: Wed, 18 Oct 2017 10:23:48 -0500 Subject: [PATCH] Enable support for MSG_DONTWAIT in lwip_recvmsg() Enables support for MSG_DONTWAIT in lwip_recvmsg(). Support already exists in lwip_recv_tcp() and lwip_recvfrom_udp_raw(); these are both accessible from lwip_recvfrom(), which already supports MSG_DONTWAIT. Signed-off-by: Nate Karstens Signed-off-by: Joel Cunningham --- src/api/sockets.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index ff983af5..535ae073 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -1212,7 +1212,7 @@ lwip_recvmsg(int s, struct msghdr *message, int flags) LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void *)message, flags)); LWIP_ERROR("lwip_recvmsg: invalid message pointer", message != NULL, return ERR_ARG;); - LWIP_ERROR("lwip_recvmsg: unsupported flags", ((flags == 0) || (flags == MSG_PEEK)), + LWIP_ERROR("lwip_recvmsg: unsupported flags", (flags & ~(MSG_PEEK|MSG_DONTWAIT)) == 0, set_errno(EOPNOTSUPP); return -1;); if ((message->msg_iovlen <= 0) || (message->msg_iovlen > IOV_MAX)) { @@ -1260,8 +1260,7 @@ lwip_recvmsg(int s, struct msghdr *message, int flags) } break; } - /* while MSG_DONTWAIT is not supported for this function, we pass it to - lwip_recv_tcp() to prevent waiting for more data */ + /* pass MSG_DONTWAIT to lwip_recv_tcp() to prevent waiting for more data */ recv_flags |= MSG_DONTWAIT; } if (buflen > 0) {