aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_send.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_send.c')
-rw-r--r--src/microhttpd/mhd_send.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 6ad79fb9..8ff9b459 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -50,7 +50,6 @@
50 * to be used in: send_param_adapter, MHD_send_ 50 * to be used in: send_param_adapter, MHD_send_
51 * and every place where sendfile(), sendfile64(), setsockopt() are used. 51 * and every place where sendfile(), sendfile64(), setsockopt() are used.
52 * 52 *
53 * Fix this up in doxygen style:
54 * -- OBJECTIVE: 53 * -- OBJECTIVE:
55 * connection: use member 'socket', and remember the 54 * connection: use member 'socket', and remember the
56 * current state of the socket-options (cork/nocork/nodelay/whatever) 55 * current state of the socket-options (cork/nocork/nodelay/whatever)
@@ -98,17 +97,17 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
98 case MHD_SSO_NO_CORK: 97 case MHD_SSO_NO_CORK:
99 want_cork = false; 98 want_cork = false;
100 break; 99 break;
101 /* Do corking, consider MSG_MORE instead if available */ 100 /* Do corking, consider MSG_MORE instead if available. */
102 case MHD_SSO_MAY_CORK: 101 case MHD_SSO_MAY_CORK:
103 want_cork = true; 102 want_cork = true;
104 break; 103 break;
105 /* Cork the header */ 104 /* Cork the header. */
106 case MHD_SSO_HDR_CORK: 105 case MHD_SSO_HDR_CORK:
107 want_cork = (buffer_size >= 1024) && (buffer_size <= 1220); 106 want_cork = (buffer_size >= 1024) && (buffer_size <= 1220);
108 break; 107 break;
109 } 108 }
110 109
111 // ! could be avoided by redefining the variable 110 /* ! could be avoided by redefining the variable. */
112 have_cork = ! connection->sk_tcp_nodelay_on; 111 have_cork = ! connection->sk_tcp_nodelay_on;
113 112
114#ifdef MSG_MORE 113#ifdef MSG_MORE
@@ -270,10 +269,20 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
270 } 269 }
271 } 270 }
272#elif TCP_NOPUSH 271#elif TCP_NOPUSH
273 // We don't have MSG_MORE. 272 /* We don't have MSG_MORE. The OS which implement NOPUSH implement
274 if (use_corknopush) 273 * it in a similar way to TCP_CORK on Linux. This means we can just
274 * disregard the else branch for TCP_NODELAY which we had to use
275 * for the TCP_CORK case here. */
276 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
275 { 277 {
276 if (! have_more && )// ... 278 if (0 == setsockopt (s,
279 IPPROTO_TCP,
280 TCP_NOPUSH,
281 (const void*) &on_val,
282 sizeof (on_val)))
283 {
284 connection->sk_tcp_nodelay_on = false;
285 }
277 } 286 }
278#endif 287#endif
279 288
@@ -364,7 +373,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
364 eno = errno; 373 eno = errno;
365 if ((ret == header_len + buffer_len) && have_cork) 374 if ((ret == header_len + buffer_len) && have_cork)
366 { 375 {
367 // response complete, definitely uncork! 376 // Response complete, definitely uncork!
368 setsockopt (s, 377 setsockopt (s,
369 IPPROTO_TCP, 378 IPPROTO_TCP,
370 TCP_CORK, 379 TCP_CORK,