diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-12-11 20:28:06 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-12-11 20:28:06 +0300 |
commit | d4acdb285f54ef96aca423405f84933bf89e9f86 (patch) | |
tree | 46c3156151aa6a535d8a0e3e33385ec26b91370b | |
parent | 9e45e2486f4e24552439cef43d61d841229a8fea (diff) | |
download | libmicrohttpd-d4acdb285f54ef96aca423405f84933bf89e9f86.tar.gz libmicrohttpd-d4acdb285f54ef96aca423405f84933bf89e9f86.zip |
new_connection_prepare_(): removed extra sys-call
-rw-r--r-- | src/microhttpd/daemon.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index a650eefe..46cfad0e 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2460,34 +2460,17 @@ new_connection_prepare_ (struct MHD_Daemon *daemon, | |||
2460 | errno = eno; | 2460 | errno = eno; |
2461 | return MHD_NO; | 2461 | return MHD_NO; |
2462 | } | 2462 | } |
2463 | #if defined(MHD_TCP_CORK_NOPUSH) || defined(MHD_USE_MSG_MORE) | 2463 | |
2464 | if (! external_add) | 2464 | if (! external_add) |
2465 | { | ||
2465 | connection->sk_corked = _MHD_OFF; | 2466 | connection->sk_corked = _MHD_OFF; |
2467 | connection->sk_nodelay = _MHD_OFF; | ||
2468 | } | ||
2466 | else | 2469 | else |
2467 | connection->sk_corked = _MHD_UNKNOWN; | ||
2468 | |||
2469 | /* We will use TCP_CORK or TCP_NOPUSH or MSG_MORE to control | ||
2470 | transmission, disable Nagle's algorithm (always) */ | ||
2471 | if (0 != MHD_socket_set_nodelay_ (client_socket, true)) | ||
2472 | { | 2470 | { |
2473 | if (EOPNOTSUPP != MHD_socket_get_error_ ()) | 2471 | connection->sk_corked = _MHD_UNKNOWN; |
2474 | { | ||
2475 | #ifdef HAVE_MESSAGES | ||
2476 | MHD_DLOG (daemon, | ||
2477 | _ ("Failed to disable TCP Nagle on socket: %s\n"), | ||
2478 | MHD_socket_last_strerr_ ()); | ||
2479 | #endif | ||
2480 | } | ||
2481 | connection->sk_nodelay = _MHD_UNKNOWN; | 2472 | connection->sk_nodelay = _MHD_UNKNOWN; |
2482 | } | 2473 | } |
2483 | else | ||
2484 | connection->sk_nodelay = _MHD_ON; | ||
2485 | #else /* !MHD_TCP_CORK_NOPUSH && !MHD_USE_MSG_MORE */ | ||
2486 | if (! external_add) | ||
2487 | connection->sk_nodelay = _MHD_OFF; | ||
2488 | else | ||
2489 | connection->sk_nodelay = _MHD_UNKNOWN; | ||
2490 | #endif /* !MHD_TCP_CORK_NOPUSH && !MHD_USE_MSG_MORE */ | ||
2491 | 2474 | ||
2492 | connection->connection_timeout = daemon->connection_timeout; | 2475 | connection->connection_timeout = daemon->connection_timeout; |
2493 | if (NULL == (connection->addr = malloc (addrlen))) | 2476 | if (NULL == (connection->addr = malloc (addrlen))) |