aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-10-29 19:50:58 +0000
committerChristian Grothoff <christian@grothoff.org>2014-10-29 19:50:58 +0000
commitfd9472386333a7d2a2a7c298641b64167f3598ac (patch)
treeeedb34415ec4397a2c29380ce2a2d438a4375689 /doc
parentcde3691e85724707c55d776fad3e93454eaf24d1 (diff)
downloadlibmicrohttpd-fd9472386333a7d2a2a7c298641b64167f3598ac.tar.gz
libmicrohttpd-fd9472386333a7d2a2a7c298641b64167f3598ac.zip
Hi Christian,
I attach the first attempt on SO_REUSEPORT. The patch is available either at https://github.com/foxik/libmicrohttpd/commit/9ce9422742e10458f87275ea202a982e00c2b88c or attached. (It is against the version with MHD_DAEMON_OPTION_CURRENT_CONNECTIONS, but I can rebase it to current SVN HEAD if you want.) It seems that a reasonably multiplatform way of detecting SO_REUSEPORT is #ifdef SO_REPOSEPORT which is used for example by Perl. For SO_EXCLUSIVEADDRUSE, the same strategy seems to work too, according to Windows SDK headers and MinGW WinAPI headers. The current patch adds an option to allowing/disallowing address:port reuse. One remark: - currently both nonexisting SO_xxx and setsockopt failure are fatal and MHD_start_daemon fails. That may be too harsh -- maybe the MHD_OPTION_LISTENING_ADDRESS_REUSE should be only a hint. Nevertheless, as one can freely not use MHD_OPTION_LISTENING_ADDRESS_REUSE option, I chose the "fail on error" behaviour. Thanks, cheers, Milan Straka Original patch modified to get rid of some redundant USE_DEBUG checks, fix indentation, and #ifndef SO_REUSEPORT on Linux, we try be #defining it to 15 ourselves.
Diffstat (limited to 'doc')
-rw-r--r--doc/libmicrohttpd.texi14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index dcfbfc9d..91579c62 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -856,6 +856,20 @@ by the HTTPS daemon for key exchange. This option must be followed by
856a @code{const char *} argument. The argument would be a zero-terminated 856a @code{const char *} argument. The argument would be a zero-terminated
857string with a PEM encoded PKCS3 DH parameters structure suitable 857string with a PEM encoded PKCS3 DH parameters structure suitable
858for passing to @code{gnutls_dh_parms_import_pkcs3}. 858for passing to @code{gnutls_dh_parms_import_pkcs3}.
859
860@item MHD_OPTION_LISTENING_ADDRESS_REUSE
861@cindex bind, restricting bind
862@cindex reusing listening address
863This option must be followed by a @code{unsigned int} argument.
864If this option is present and true (nonzero) parameter is given, allow reusing
865the address:port of the listening socket (using @code{SO_REUSEPORT} on most
866platforms, and @code{SO_REUSEADDR} on Windows). If a false (zero) parameter is
867given, disallow reusing the the address:port of the listening socket (this
868usually requires no special action, but @code{SO_EXCLUSIVEADDRUSE} is needed on
869Windows). If this option is not present, default behaviour is undefined
870(currently, @code{SO_REUSEADDR} is used on all platforms, which disallows
871address:port reusing with the exception of Windows).
872
859@end table 873@end table
860@end deftp 874@end deftp
861 875