aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/microhttpd/connection.c127
1 files changed, 0 insertions, 127 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c2add01a..cee38b8d 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -320,51 +320,6 @@ _MHD_static_inline bool
320socket_start_extra_buffering (struct MHD_Connection *connection) 320socket_start_extra_buffering (struct MHD_Connection *connection)
321{ 321{
322 mhd_assert(NULL != connection); 322 mhd_assert(NULL != connection);
323#if OLD_SOCKOPT
324#if defined(TCP_NODELAY)
325 if (connection->sk_tcp_nodelay_on)
326 {
327 const MHD_SCKT_OPT_BOOL_ off_val = 0;
328 /* Enable Nagle's algorithm */
329 /* TCP_NODELAY may interfere with TCP_NOPUSH */
330 if (0 == setsockopt (connection->socket_fd,
331 IPPROTO_TCP,
332 TCP_NODELAY,
333 (const void *) &off_val,
334 sizeof (off_val)))
335 {
336 connection->sk_tcp_nodelay_on = false;
337 }
338 }
339#endif /* TCP_NODELAY */
340#endif /* OLD_SOCKOPT */
341
342#if OLD_SOCKOPT
343#if defined(MHD_TCP_CORK_NOPUSH)
344 if (!connection->sk_tcp_cork_nopush_on)
345 {
346 const MHD_SCKT_OPT_BOOL_ on_val = 1;
347 /* Buffer data before sending (TCP_CORK) or
348 * Send only full frames (TCP_NOPUSH) */
349 if (0 == setsockopt (connection->socket_fd,
350 IPPROTO_TCP,
351 MHD_TCP_CORK_NOPUSH,
352 (const void *) &on_val,
353 sizeof (on_val)))
354 {
355 connection->sk_tcp_cork_nopush_on = true;
356 }
357 }
358#endif /* MHD_TCP_CORK_NOPUSH */
359#endif /* OLD_SOCKOPT */
360
361#if OLD_SOCKOPT
362#if defined(TCP_NODELAY)
363 return connection->sk_tcp_cork_nopush_on && !connection->sk_tcp_nodelay_on;
364#else /* ! TCP_NODELAY */
365 return connection->sk_tcp_cork_nopush_on;
366#endif /* ! TCP_NODELAY */
367#endif /* OLD_SOCKOPT */
368} 323}
369 324
370 325
@@ -377,40 +332,7 @@ socket_start_extra_buffering (struct MHD_Connection *connection)
377_MHD_static_inline bool 332_MHD_static_inline bool
378socket_start_no_buffering (struct MHD_Connection *connection) 333socket_start_no_buffering (struct MHD_Connection *connection)
379{ 334{
380#if OLD_SOCKOPT
381#if defined(MHD_TCP_CORK_NOPUSH)
382 if (connection->sk_tcp_cork_nopush_on)
383 {
384 const MHD_SCKT_OPT_BOOL_ off_val = 0;
385 /* Disable extra buffering */
386 if (0 == setsockopt (connection->socket_fd,
387 IPPROTO_TCP,
388 MHD_TCP_CORK_NOPUSH,
389 (const void *) &off_val,
390 sizeof (off_val)))
391 {
392 connection->sk_tcp_cork_nopush_on = false;
393 }
394 }
395#endif /* MHD_TCP_CORK_NOPUSH */
396 335
397#if defined(TCP_NODELAY)
398 if (!connection->sk_tcp_nodelay_on)
399 {
400 const MHD_SCKT_OPT_BOOL_ on_val = 1;
401 /* Enable sending without delay */
402 if (0 == setsockopt (connection->socket_fd,
403 IPPROTO_TCP,
404 TCP_NODELAY,
405 (const void *) &on_val,
406 sizeof (on_val)))
407 {
408 connection->sk_tcp_nodelay_on = true;
409 }
410 }
411#endif /* TCP_NODELAY */
412 return connection->sk_tcp_nodelay_on && !connection->sk_tcp_cork_nopush_on;
413#endif /* OLD_SOCKOPT */
414} 336}
415 337
416 338
@@ -428,21 +350,6 @@ socket_start_no_buffering_flush (struct MHD_Connection *connection)
428#if defined(TCP_NOPUSH) && !defined(TCP_CORK) 350#if defined(TCP_NOPUSH) && !defined(TCP_CORK)
429 const int dummy = 0; 351 const int dummy = 0;
430#endif /* !TCP_CORK */ 352#endif /* !TCP_CORK */
431#if OLD_SOCKOPT
432#if defined(TCP_CORK) || (defined(__FreeBSD__) && __FreeBSD__+0 >= 9)
433 const MHD_SCKT_OPT_BOOL_ off_val = 0;
434 /* Switching off TCP_CORK flush buffer even
435 * if TCP_CORK was not enabled */
436 if (0 == setsockopt (connection->socket_fd,
437 IPPROTO_TCP,
438 MHD_TCP_CORK_NOPUSH,
439 (const void *) &off_val,
440 sizeof (off_val)))
441 {
442 connection->sk_tcp_cork_nopush_on = false;
443 }
444#endif /* MHD_TCP_CORK_NOPUSH */
445#endif /* OLD_SOCKOPT */
446 res = socket_start_no_buffering (connection); 353 res = socket_start_no_buffering (connection);
447#if defined(__FreeBSD__) && __FreeBSD__+0 >= 9 354#if defined(__FreeBSD__) && __FreeBSD__+0 >= 9
448 /* FreeBSD do not need zero-send for flushing starting from version 9 */ 355 /* FreeBSD do not need zero-send for flushing starting from version 9 */
@@ -468,40 +375,6 @@ _MHD_static_inline bool
468socket_start_normal_buffering (struct MHD_Connection *connection) 375socket_start_normal_buffering (struct MHD_Connection *connection)
469{ 376{
470 mhd_assert(NULL != connection); 377 mhd_assert(NULL != connection);
471#if OLD_SOCKOPT
472#if defined(MHD_TCP_CORK_NOPUSH)
473 if (connection->sk_tcp_cork_nopush_on)
474 {
475 const MHD_SCKT_OPT_BOOL_ off_val = 0;
476 /* Disable extra buffering */
477 if (0 == setsockopt (connection->socket_fd,
478 IPPROTO_TCP,
479 MHD_TCP_CORK_NOPUSH,
480 (const void *) &off_val,
481 sizeof (off_val)))
482 {
483 connection->sk_tcp_cork_nopush_on = false;
484 }
485 }
486#endif /* MHD_TCP_CORK_NOPUSH */
487
488#if defined(TCP_NODELAY)
489 if (connection->sk_tcp_nodelay_on)
490 {
491 const MHD_SCKT_OPT_BOOL_ off_val = 0;
492 /* Enable Nagle's algorithm */
493 if (0 == setsockopt (connection->socket_fd,
494 IPPROTO_TCP,
495 TCP_NODELAY,
496 (const void *) &off_val,
497 sizeof (off_val)))
498 {
499 connection->sk_tcp_nodelay_on = false;
500 }
501 }
502#endif /* TCP_NODELAY */
503 return !connection->sk_tcp_nodelay_on && !connection->sk_tcp_cork_nopush_on;
504#endif
505} 378}
506 379
507 380