aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent2a0c96ff5bba1bf153e067e5021f974dbca71525 (diff)
downloadlibmicrohttpd-61858b1e1af6a9c73e778c3f5765d5819ad6c924.tar.gz
libmicrohttpd-61858b1e1af6a9c73e778c3f5765d5819ad6c924.zip
mhd_sockets: removed dead code
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/mhd_sockets.c78
-rw-r--r--src/microhttpd/mhd_sockets.h34
2 files changed, 0 insertions, 112 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
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index b16a8b1a..5e82faa6 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -892,40 +892,6 @@ int
892MHD_socket_noninheritable_ (MHD_socket sock); 892MHD_socket_noninheritable_ (MHD_socket sock);
893 893
894 894
895/**
896 * Enable/disable the cork option.
897 *
898 * TCP_NOPUSH has the same logic as MSG_MSG_MORE.
899 * The two are more or less equivalent by a source
900 * transformation (ie
901 * send(MSG_MORE) => "set TCP_NOPUSH + send() + clear TCP_NOPUSH".
902 * Both of them are really fairly "local", but TCP_NOPUSH has a
903 * _notion_ of persistency that is entirely lacking in MSG_MORE.
904 * ... with TCP_NOPUSH you basically have to know what your last
905 * write is, and clear the bit _before_ that write if you want
906 * to avoid bad latencies.
907 *
908 * See also: https://yarchive.net/comp/linux/sendfile.html
909 *
910 * @param sock socket to manipulate
911 * @param on set to true to enable CORK, false to disable
912 * @return non-zero if succeeded, zero otherwise
913 */
914int
915MHD_socket_cork_ (MHD_socket sock,
916 bool on);
917
918
919/**
920 * Change socket buffering mode to default.
921 *
922 * @param sock socket to manipulate
923 * @return non-zero if succeeded, zero otherwise
924 */
925int
926MHD_socket_buffering_reset_ (MHD_socket sock);
927
928
929#if defined(SOL_SOCKET) && defined(SO_NOSIGPIPE) 895#if defined(SOL_SOCKET) && defined(SO_NOSIGPIPE)
930static const int _MHD_socket_int_one = 1; 896static const int _MHD_socket_int_one = 1;
931/** 897/**