From f85f859219ab76b8d2c6a894d7d67ac19656bf9d Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 23 Feb 2021 21:40:00 +0300 Subject: mhd_send: use MSG_MORE for iovec --- src/microhttpd/mhd_send.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index c2cded87..f3028293 100644 --- 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 -- cgit v1.2.3