From df7485de1c5bbf25fb3c2cb363c9b9afb4d0320d Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 2 Mar 2017 09:27:32 +0100 Subject: [PATCH] lwip_sendmsg/tcp: prevent PSH until all iovecs are enqueued (cherry picked from commit 1b3aaef52512219ced9e769a81667f036a6c00a1) --- src/api/sockets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/sockets.c b/src/api/sockets.c index 1e7e6bae..6cfd27b3 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -994,6 +994,10 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags) ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0); for (i = 0; i < msg->msg_iovlen; i++) { + u8_t apiflags = write_flags; + if (i + 1 < msg->msg_iovlen) { + apiflags |= NETCONN_MORE; + } written = 0; err = netconn_write_partly(sock->conn, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len, write_flags, &written); if (err == ERR_OK) {