aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_sockets.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-18 13:47:37 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-18 13:47:37 +0300
commit61858b1e1af6a9c73e778c3f5765d5819ad6c924 (patch)
treeef6b459a9082de2fb978227946ee7e74d1ff7def /src/microhttpd/mhd_sockets.c
parent2a0c96ff5bba1bf153e067e5021f974dbca71525 (diff)
downloadlibmicrohttpd-61858b1e1af6a9c73e778c3f5765d5819ad6c924.tar.gz
libmicrohttpd-61858b1e1af6a9c73e778c3f5765d5819ad6c924.zip
mhd_sockets: removed dead code
Diffstat (limited to 'src/microhttpd/mhd_sockets.c')
-rw-r--r--src/microhttpd/mhd_sockets.c78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index fef7085c..aae8a496 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -490,84 +490,6 @@ MHD_socket_set_nodelay_ (MHD_socket sock,
490 490
491 491
492/** 492/**
493 * Enable/disable the cork option.
494 *
495 * @param sock socket to manipulate
496 * @param on set to true to enable CORK, false to disable
497 * @return non-zero if succeeded, zero otherwise
498 */
499int
500MHD_socket_cork_ (MHD_socket sock,
501 bool on)
502{
503#if defined(MHD_TCP_CORK_NOPUSH)
504 const MHD_SCKT_OPT_BOOL_ off_val = 0;
505 const MHD_SCKT_OPT_BOOL_ on_val = 1;
506
507 /* Disable extra buffering */
508 if (MHD_INVALID_SOCKET == sock)
509 {
510 errno = EBADF;
511 return 0; /* failed */
512 }
513 if (0 != setsockopt (sock,
514 IPPROTO_TCP,
515 MHD_TCP_CORK_NOPUSH,
516 (const void *) (on ? &on_val : &off_val),
517 sizeof (off_val)))
518 return 0; /* failed */
519#if defined(_MHD_CORK_RESET_PUSH_DATA)
520 return 1;
521#else /* ! _MHD_CORK_RESET_PUSH_DATA */
522 if (! on)
523 {
524 const int dummy = 0;
525 /* Force flush data with zero send otherwise Darwin and some BSD systems
526 will add 5 seconds delay. Not required with TCP_CORK as switching off
527 TCP_CORK always flushes socket buffer. */
528 if (0 > send (sock,
529 &dummy,
530 0,
531 0))
532 return 0; /* even force flush failed!? */
533 return 1; /* success */
534 }
535 return 1;
536#endif /* ! _MHD_CORK_RESET_PUSH_DATA */
537#else /* ! MHD_TCP_CORK_NOPUSH */
538 /* do not have MHD_TCP_CORK_NOPUSH at all */
539 (void) sock; (void) on; /* Mute compiler warnings */
540 return 0;
541#endif /* ! MHD_TCP_CORK_NOPUSH */
542}
543
544
545/**
546 * Change socket buffering mode to default.
547 *
548 * @param sock socket to manipulate
549 * @return non-zero if succeeded, zero otherwise
550 */
551int
552MHD_socket_buffering_reset_ (MHD_socket sock)
553{
554#if defined(MHD_TCP_CORK_NOPUSH)
555 int res = ! MHD_socket_set_nodelay_ (sock,
556 true);
557 /* Disable extra buffering */
558 return MHD_socket_cork_ (sock,
559 false) && res;
560#elif defined(HAVE_MSG_MORE)
561 return ! MHD_socket_set_nodelay_ (sock,
562 true);
563#else
564 return ! MHD_socket_set_nodelay_ (sock,
565 false);
566#endif /* MHD_TCP_CORK_NOPUSH */
567}
568
569
570/**
571 * Create a listen socket, with noninheritable flag if possible. 493 * Create a listen socket, with noninheritable flag if possible.
572 * 494 *
573 * @param pf protocol family to use 495 * @param pf protocol family to use