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 /src/microhttpd/connection_https.c | |
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 'src/microhttpd/connection_https.c')
-rw-r--r-- | src/microhttpd/connection_https.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c index b566d83c..0d7d5980 100644 --- a/src/microhttpd/connection_https.c +++ b/src/microhttpd/connection_https.c | |||
@@ -134,8 +134,10 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection) | |||
134 | unsigned int timeout; | 134 | unsigned int timeout; |
135 | 135 | ||
136 | #if DEBUG_STATES | 136 | #if DEBUG_STATES |
137 | MHD_DLOG (connection->daemon, "%s: state: %s\n", | 137 | MHD_DLOG (connection->daemon, |
138 | __FUNCTION__, MHD_state_to_string (connection->state)); | 138 | "%s: state: %s\n", |
139 | __FUNCTION__, | ||
140 | MHD_state_to_string (connection->state)); | ||
139 | #endif | 141 | #endif |
140 | timeout = connection->connection_timeout; | 142 | timeout = connection->connection_timeout; |
141 | if ( (timeout != 0) && (timeout <= (MHD_monotonic_time() - connection->last_activity))) | 143 | if ( (timeout != 0) && (timeout <= (MHD_monotonic_time() - connection->last_activity))) |