aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-07-24 11:48:02 +0000
committerng0 <ng0@n0.is>2019-07-24 11:48:02 +0000
commit304002d6b1d88baa747207f0d5d8ae77bda2b118 (patch)
tree87c2dd90c29587881b711348fd61fd3a358bedf6
parent7bfe541156884d5baeb671a2bd90e4c51851533b (diff)
downloadlibmicrohttpd-304002d6b1d88baa747207f0d5d8ae77bda2b118.tar.gz
libmicrohttpd-304002d6b1d88baa747207f0d5d8ae77bda2b118.zip
remove commented code, replaced by functions.
-rw-r--r--src/microhttpd/connection.c10
-rw-r--r--src/microhttpd/mhd_send.c76
2 files changed, 9 insertions, 77 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 6198e1ff..719ba7b6 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -513,16 +513,6 @@ sendfile_adapter (struct MHD_Connection *connection)
513 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork)) 513 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
514 { 514 {
515 MHD_send_socket_state_nopush_ (connection, true, false); 515 MHD_send_socket_state_nopush_ (connection, true, false);
516 /*
517 if (0 == setsockopt (connection->socket_fd,
518 IPPROTO_TCP,
519 TCP_NOPUSH,
520 (const void *) &on_val,
521 sizeof (on_val)))
522 {
523 connection->sk_tcp_nodelay_on = false;
524 }
525 */
526 } 516 }
527#endif 517#endif
528 518
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 2b2f9d93..56461942 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -26,6 +26,12 @@
26 26
27/* TODO: sendfile() wrapper, in connection.c */ 27/* TODO: sendfile() wrapper, in connection.c */
28 28
29/* Worth considering for future improvements and additions:
30 * NetBSD has no sendfile or sendfile64. The way to work
31 * with this seems to be to mmap the file and write(2) as
32 * large a chunk as possible to the socket. Alternatively,
33 * use madvise(..., MADV_SEQUENTIAL). */
34
29/* Functions to be used in: send_param_adapter, MHD_send_ 35/* Functions to be used in: send_param_adapter, MHD_send_
30 * and every place where sendfile(), sendfile64(), setsockopt() 36 * and every place where sendfile(), sendfile64(), setsockopt()
31 * are used. */ 37 * are used. */
@@ -201,31 +207,11 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
201 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork)) 207 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
202 { 208 {
203 MHD_send_socket_state_nopush_ (connection, true, false); 209 MHD_send_socket_state_nopush_ (connection, true, false);
204 /*
205 if (0 == setsockopt (s,
206 IPPROTO_TCP,
207 TCP_NOPUSH,
208 (const void *) &on_val,
209 sizeof (on_val)))
210 {
211 connection->sk_tcp_nodelay_on = false;
212 }
213 */
214 } 210 }
215#endif 211#endif
216#if TCP_NODELAY 212#if TCP_NODELAY
217 if ((! using_tls) && (! use_corknopush) && (! have_cork && want_cork)) 213 if ((! using_tls) && (! use_corknopush) && (! have_cork && want_cork))
218 { 214 {
219 /*
220 if (0 == setsockopt (s,
221 IPPROTO_TCP,
222 TCP_NODELAY,
223 (const void *) &off_val,
224 sizeof (off_val)))
225 {
226 connection->sk_tcp_nodelay_on = false;
227 }
228 */
229 MHD_send_socket_state_nodelay_ (connection, false); 215 MHD_send_socket_state_nodelay_ (connection, false);
230 } 216 }
231#endif 217#endif
@@ -332,20 +318,12 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
332 /* We don't have MSG_MORE. The OS which implement NOPUSH implement 318 /* We don't have MSG_MORE. The OS which implement NOPUSH implement
333 * it in a similar way to TCP_CORK on Linux. This means we can just 319 * it in a similar way to TCP_CORK on Linux. This means we can just
334 * disregard the else branch for TCP_NODELAY which we had to use 320 * disregard the else branch for TCP_NODELAY which we had to use
335 * for the TCP_CORK case here. */ 321 * for the TCP_CORK case here.
322 * XXX: Verify this statement and finetune if necessary for
323 * other systems, as only FreeBSD was checked. */
336 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork)) 324 if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
337 { 325 {
338 MHD_send_socket_state_nopush_ (connection, true, false); 326 MHD_send_socket_state_nopush_ (connection, true, false);
339 /*
340 if (0 == setsockopt (s,
341 IPPROTO_TCP,
342 TCP_NOPUSH,
343 (const void*) &on_val,
344 sizeof (on_val)))
345 {
346 connection->sk_tcp_nodelay_on = false;
347 }
348 */
349 } 327 }
350#endif 328#endif
351 329
@@ -353,16 +331,6 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
353 if ((! using_tls) && (! use_corknopush) && (have_cork && ! want_cork)) 331 if ((! using_tls) && (! use_corknopush) && (have_cork && ! want_cork))
354 { 332 {
355 MHD_send_socket_state_nodelay_ (connection, true); 333 MHD_send_socket_state_nodelay_ (connection, true);
356 /*
357 if (0 == setsockopt (s,
358 IPPROTO_TCP,
359 TCP_NODELAY,
360 (const void *) &on_val,
361 sizeof (on_val)))
362 {
363 connection->sk_tcp_nodelay_on = true;
364 }
365 */
366 } 334 }
367#endif 335#endif
368 336
@@ -416,16 +384,6 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
416 if ((! use_corknopush) && (! have_cork && want_cork)) 384 if ((! use_corknopush) && (! have_cork && want_cork))
417 { 385 {
418 MHD_send_socket_state_nodelay_ (connection, false); 386 MHD_send_socket_state_nodelay_ (connection, false);
419 /*
420 if (0 == setsockopt (s,
421 IPPROTO_TCP,
422 TCP_NODELAY,
423 (const void *) &off_val,
424 sizeof (off_val)))
425 {
426 connection->sk_tcp_nodelay_on = false;
427 }
428 */
429 } 387 }
430#endif 388#endif
431 389
@@ -475,16 +433,6 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
475 { 433 {
476 /* Response complete, set NOPUSH to off */ 434 /* Response complete, set NOPUSH to off */
477 MHD_send_socket_state_nopush_ (connection, false, false); 435 MHD_send_socket_state_nopush_ (connection, false, false);
478 /*
479 if (0 == setsockopt (s,
480 IPPROTO_TCP,
481 TCP_NOPUSH,
482 (const void *) &off_val,
483 sizeof (off_val)))
484 {
485 connection->sk_tcp_nodelay_on = false;
486 }
487 */
488 } 436 }
489 errno = eno; 437 errno = eno;
490 } 438 }
@@ -498,9 +446,3 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
498 MHD_SSO_HDR_CORK); 446 MHD_SSO_HDR_CORK);
499#endif 447#endif
500} 448}
501
502/* Worth considering for future improvements and additions:
503 * NetBSD has no sendfile or sendfile64. The way to work
504 * with this seems to be to mmap the file and write(2) as
505 * large a chunk as possible to the socket. Alternatively,
506 * use madvise(..., MADV_SEQUENTIAL). */