diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index a7ad7220..fbe9f9d3 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -239,6 +239,7 @@ sendfile_adapter (struct MHD_Connection *connection) | |||
239 | off64_t offset; | 239 | off64_t offset; |
240 | #endif /* HAVE_SENDFILE64 */ | 240 | #endif /* HAVE_SENDFILE64 */ |
241 | const bool used_thr_p_c = (0 != (connection->daemon->options & MHD_USE_THREAD_PER_CONNECTION)); | 241 | const bool used_thr_p_c = (0 != (connection->daemon->options & MHD_USE_THREAD_PER_CONNECTION)); |
242 | const size_t chunk_size = used_thr_p_c ? 0x200000 : 0x20000; | ||
242 | size_t send_size; | 243 | size_t send_size; |
243 | mhd_assert (MHD_resp_sender_sendfile == connection->resp_sender); | 244 | mhd_assert (MHD_resp_sender_sendfile == connection->resp_sender); |
244 | 245 | ||
@@ -246,10 +247,7 @@ sendfile_adapter (struct MHD_Connection *connection) | |||
246 | left = connection->response->total_size - connection->response_write_position; | 247 | left = connection->response->total_size - connection->response_write_position; |
247 | /* Do not allow system to stick sending on single fast connection: | 248 | /* Do not allow system to stick sending on single fast connection: |
248 | * use 128KiB chunks (2MiB for thread-per-connection). */ | 249 | * use 128KiB chunks (2MiB for thread-per-connection). */ |
249 | if (!used_thr_p_c) | 250 | send_size = (left > chunk_size) ? chunk_size : (size_t) left; |
250 | send_size = (left > 0x20000) ? 0x20000 : (size_t) left; | ||
251 | else | ||
252 | send_size = (left > 0x200000) ? 0x200000 : (size_t) left; | ||
253 | #ifndef HAVE_SENDFILE64 | 251 | #ifndef HAVE_SENDFILE64 |
254 | if ((uint64_t)OFF_T_MAX < offsetu64) | 252 | if ((uint64_t)OFF_T_MAX < offsetu64) |
255 | { /* Retry to send with standard 'send()'. */ | 253 | { /* Retry to send with standard 'send()'. */ |