commit f85f859219ab76b8d2c6a894d7d67ac19656bf9d
parent a22b8cdf03889885c9a0d30fef9d5233a97ede35
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Tue, 23 Feb 2021 21:40:00 +0300
mhd_send: use MSG_MORE for iovec
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
@@ -1288,7 +1288,7 @@ send_iov_nontls (struct MHD_Connection *connection,
return MHD_ERR_NOTCONN_;
}
- pre_send_setopt (connection, false, push_data);
+ pre_send_setopt (connection, true, push_data);
items_to_send = r_iov->cnt - r_iov->sent;
#ifdef HAVE_SENDMSG
@@ -1296,7 +1296,12 @@ send_iov_nontls (struct MHD_Connection *connection,
msg.msg_iov = r_iov->iov + r_iov->sent;
msg.msg_iovlen = items_to_send;
+#ifdef MHD_USE_MSG_MORE
+ res = sendmsg (connection->socket_fd, &msg,
+ MSG_NOSIGNAL_OR_ZERO | (push_data ? 0 : MSG_MORE));
+#else /* ! MHD_USE_MSG_MORE */
res = sendmsg (connection->socket_fd, &msg, MSG_NOSIGNAL_OR_ZERO);
+#endif /* ! MHD_USE_MSG_MORE */
#elif defined(HAVE_WRITEV)
res = writev (connection->socket_fd, r_iov->iov + r_iov->sent,
items_to_send);
@@ -1349,7 +1354,7 @@ send_iov_nontls (struct MHD_Connection *connection,
}
if (r_iov->cnt == r_iov->sent)
- post_send_setopt (connection, false, push_data);
+ post_send_setopt (connection, true, push_data);
else
{
#ifdef EPOLL_SUPPORT