diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-10-29 19:50:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-10-29 19:50:58 +0000 |
commit | fd9472386333a7d2a2a7c298641b64167f3598ac (patch) | |
tree | eedb34415ec4397a2c29380ce2a2d438a4375689 /doc | |
parent | cde3691e85724707c55d776fad3e93454eaf24d1 (diff) | |
download | libmicrohttpd-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.texi | 14 |
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 | |||
856 | a @code{const char *} argument. The argument would be a zero-terminated | 856 | a @code{const char *} argument. The argument would be a zero-terminated |
857 | string with a PEM encoded PKCS3 DH parameters structure suitable | 857 | string with a PEM encoded PKCS3 DH parameters structure suitable |
858 | for passing to @code{gnutls_dh_parms_import_pkcs3}. | 858 | for 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 | ||
863 | This option must be followed by a @code{unsigned int} argument. | ||
864 | If this option is present and true (nonzero) parameter is given, allow reusing | ||
865 | the address:port of the listening socket (using @code{SO_REUSEPORT} on most | ||
866 | platforms, and @code{SO_REUSEADDR} on Windows). If a false (zero) parameter is | ||
867 | given, disallow reusing the the address:port of the listening socket (this | ||
868 | usually requires no special action, but @code{SO_EXCLUSIVEADDRUSE} is needed on | ||
869 | Windows). If this option is not present, default behaviour is undefined | ||
870 | (currently, @code{SO_REUSEADDR} is used on all platforms, which disallows | ||
871 | address:port reusing with the exception of Windows). | ||
872 | |||
859 | @end table | 873 | @end table |
860 | @end deftp | 874 | @end deftp |
861 | 875 | ||