aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_sockets.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-08-01 20:44:41 +0200
committerChristian Grothoff <christian@grothoff.org>2019-08-01 20:44:41 +0200
commitc5081fb276b52fc9d48b9ba441686727eafaaad8 (patch)
treed8741e84111ed226c2bc2426e18d4e90bbd85184 /src/microhttpd/mhd_sockets.h
parentda7cb682a24915a4bc37faf2c76583996fe26aea (diff)
downloadlibmicrohttpd-c5081fb276b52fc9d48b9ba441686727eafaaad8.tar.gz
libmicrohttpd-c5081fb276b52fc9d48b9ba441686727eafaaad8.zip
always set nodelay, except if we cannot cork
Diffstat (limited to 'src/microhttpd/mhd_sockets.h')
-rw-r--r--src/microhttpd/mhd_sockets.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index a684d71d..08b01c20 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -35,6 +35,7 @@
35#include "mhd_options.h" 35#include "mhd_options.h"
36 36
37#include <errno.h> 37#include <errno.h>
38#include <stdbool.h>
38 39
39#if !defined(MHD_POSIX_SOCKETS) && !defined(MHD_WINSOCK_SOCKETS) 40#if !defined(MHD_POSIX_SOCKETS) && !defined(MHD_WINSOCK_SOCKETS)
40# if !defined(_WIN32) || defined(__CYGWIN__) 41# if !defined(_WIN32) || defined(__CYGWIN__)
@@ -745,6 +746,19 @@ MHD_socket_nonblocking_ (MHD_socket sock);
745 746
746 747
747/** 748/**
749 * Disable Nagle's algorithm on @a sock. This is what we do by default for
750 * all TCP sockets in MHD, unless the platform does not support the MSG_MORE
751 * or MSG_CORK or MSG_NOPUSH options.
752 *
753 * @param sock socket to manipulate
754 * @param on value to use
755 * @return 0 on success
756 */
757int
758MHD_socket_set_nodelay_ (MHD_socket sock,
759 bool on);
760
761/**
748 * Change socket options to be non-inheritable. 762 * Change socket options to be non-inheritable.
749 * 763 *
750 * @param sock socket to manipulate 764 * @param sock socket to manipulate
@@ -756,6 +770,30 @@ MHD_socket_noninheritable_ (MHD_socket sock);
756 770
757 771
758/** 772/**
773 * Enable/disable the cork option.
774 *
775 * TCP_NOPUSH has the same logic as MSG_MSG_MORE.
776 * The two are more or less equivalent by a source
777 * transformation (ie
778 * send(MSG_MORE) => "set TCP_NOPUSH + send() + clear TCP_NOPUSH".
779 * Both of them are really fairly "local", but TCP_NOPUSH has a
780 * _notion_ of persistency that is entirely lacking in MSG_MORE.
781 * ... with TCP_NOPUSH you basically have to know what your last
782 * write is, and clear the bit _before_ that write if you want
783 * to avoid bad latencies.
784 *
785 * See also: https://yarchive.net/comp/linux/sendfile.html
786 *
787 * @param sock socket to manipulate
788 * @param on set to true to enable CORK, false to disable
789 * @return non-zero if succeeded, zero otherwise
790 */
791int
792MHD_socket_cork_ (MHD_socket sock,
793 bool on);
794
795
796/**
759 * Change socket buffering mode to default. 797 * Change socket buffering mode to default.
760 * 798 *
761 * @param sock socket to manipulate 799 * @param sock socket to manipulate