diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-09 16:53:28 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-09 16:53:28 +0300 |
commit | 2475030dcbdb95f6843d251d6e4ee1b4be9f3f3b (patch) | |
tree | d8a746b512daf11f7991f93056671396960740ac | |
parent | a0de9d3310b337b7d2ac20e603fb4de9333ca46b (diff) | |
download | libmicrohttpd-2475030dcbdb95f6843d251d6e4ee1b4be9f3f3b.tar.gz libmicrohttpd-2475030dcbdb95f6843d251d6e4ee1b4be9f3f3b.zip |
Added use of the new internal macro MHD_D_IS_USING_THREAD_PER_CONN_
-rw-r--r-- | src/microhttpd/connection.c | 12 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 64 | ||||
-rw-r--r-- | src/microhttpd/mhd_send.c | 3 | ||||
-rw-r--r-- | src/microhttpd/response.c | 2 |
4 files changed, 39 insertions, 42 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 304c8e64..78d7d5df 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -1293,14 +1293,14 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection) | |||
1293 | 1293 | ||
1294 | #ifdef MHD_USE_THREADS | 1294 | #ifdef MHD_USE_THREADS |
1295 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ | 1295 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ |
1296 | (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ | 1296 | MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) || \ |
1297 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); | 1297 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); |
1298 | #endif /* MHD_USE_THREADS */ | 1298 | #endif /* MHD_USE_THREADS */ |
1299 | 1299 | ||
1300 | if (0 == (daemon->options & MHD_USE_TLS)) | 1300 | if (0 == (daemon->options & MHD_USE_TLS)) |
1301 | return; /* Nothing to do with non-TLS connection. */ | 1301 | return; /* Nothing to do with non-TLS connection. */ |
1302 | 1302 | ||
1303 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 1303 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
1304 | DLL_remove (daemon->urh_head, | 1304 | DLL_remove (daemon->urh_head, |
1305 | daemon->urh_tail, | 1305 | daemon->urh_tail, |
1306 | urh); | 1306 | urh); |
@@ -6351,7 +6351,7 @@ MHD_update_last_activity_ (struct MHD_Connection *connection) | |||
6351 | return; /* no activity on suspended connections */ | 6351 | return; /* no activity on suspended connections */ |
6352 | 6352 | ||
6353 | connection->last_activity = MHD_monotonic_msec_counter (); | 6353 | connection->last_activity = MHD_monotonic_msec_counter (); |
6354 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 6354 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
6355 | return; /* each connection has personal timeout */ | 6355 | return; /* each connection has personal timeout */ |
6356 | 6356 | ||
6357 | if (connection->connection_timeout_ms != daemon->connection_timeout_ms) | 6357 | if (connection->connection_timeout_ms != daemon->connection_timeout_ms) |
@@ -6973,7 +6973,7 @@ cleanup_connection (struct MHD_Connection *connection) | |||
6973 | } | 6973 | } |
6974 | else | 6974 | else |
6975 | { | 6975 | { |
6976 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 6976 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
6977 | { | 6977 | { |
6978 | if (connection->connection_timeout_ms == daemon->connection_timeout_ms) | 6978 | if (connection->connection_timeout_ms == daemon->connection_timeout_ms) |
6979 | XDLL_remove (daemon->normal_timeout_head, | 6979 | XDLL_remove (daemon->normal_timeout_head, |
@@ -6996,7 +6996,7 @@ cleanup_connection (struct MHD_Connection *connection) | |||
6996 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 6996 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
6997 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | 6997 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); |
6998 | #endif | 6998 | #endif |
6999 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 6999 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
7000 | { | 7000 | { |
7001 | /* if we were at the connection limit before and are in | 7001 | /* if we were at the connection limit before and are in |
7002 | thread-per-connection mode, signal the main thread | 7002 | thread-per-connection mode, signal the main thread |
@@ -7738,7 +7738,7 @@ MHD_set_connection_option (struct MHD_Connection *connection, | |||
7738 | ui_val = UINT64_MAX / 4000 - 1; | 7738 | ui_val = UINT64_MAX / 4000 - 1; |
7739 | } | 7739 | } |
7740 | #endif /* (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT */ | 7740 | #endif /* (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT */ |
7741 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 7741 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
7742 | { | 7742 | { |
7743 | #if defined(MHD_USE_THREADS) | 7743 | #if defined(MHD_USE_THREADS) |
7744 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 7744 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 9843866d..a53ba0d5 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1333,7 +1333,7 @@ call_handlers (struct MHD_Connection *con, | |||
1333 | * TLS read-ready connection in 'read info' state as connection | 1333 | * TLS read-ready connection in 'read info' state as connection |
1334 | * without space in read buffer will be marked as 'info block'. */ | 1334 | * without space in read buffer will be marked as 'info block'. */ |
1335 | if ( (! con->daemon->data_already_pending) && | 1335 | if ( (! con->daemon->data_already_pending) && |
1336 | (0 == (con->daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) | 1336 | (! MHD_D_IS_USING_THREAD_PER_CONN_ (con->daemon)) ) |
1337 | { | 1337 | { |
1338 | if (0 != (MHD_EVENT_LOOP_INFO_PROCESS & con->event_loop_info)) | 1338 | if (0 != (MHD_EVENT_LOOP_INFO_PROCESS & con->event_loop_info)) |
1339 | con->daemon->data_already_pending = true; | 1339 | con->daemon->data_already_pending = true; |
@@ -1708,7 +1708,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1708 | * and incoming forward buffer have some space. */ | 1708 | * and incoming forward buffer have some space. */ |
1709 | if ( (connection->tls_read_ready) && | 1709 | if ( (connection->tls_read_ready) && |
1710 | (urh->in_buffer_used < urh->in_buffer_size) && | 1710 | (urh->in_buffer_used < urh->in_buffer_size) && |
1711 | (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) | 1711 | (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) ) |
1712 | daemon->data_already_pending = true; | 1712 | daemon->data_already_pending = true; |
1713 | 1713 | ||
1714 | if ( (daemon->shutdown) && | 1714 | if ( (daemon->shutdown) && |
@@ -2875,7 +2875,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, | |||
2875 | DLL_insert (daemon->connections_head, | 2875 | DLL_insert (daemon->connections_head, |
2876 | daemon->connections_tail, | 2876 | daemon->connections_tail, |
2877 | connection); | 2877 | connection); |
2878 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 2878 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
2879 | { | 2879 | { |
2880 | XDLL_insert (daemon->normal_timeout_head, | 2880 | XDLL_insert (daemon->normal_timeout_head, |
2881 | daemon->normal_timeout_tail, | 2881 | daemon->normal_timeout_tail, |
@@ -2891,7 +2891,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, | |||
2891 | &connection->socket_context, | 2891 | &connection->socket_context, |
2892 | MHD_CONNECTION_NOTIFY_STARTED); | 2892 | MHD_CONNECTION_NOTIFY_STARTED); |
2893 | #ifdef MHD_USE_THREADS | 2893 | #ifdef MHD_USE_THREADS |
2894 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 2894 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
2895 | { | 2895 | { |
2896 | mhd_assert (! MHD_D_IS_USING_EPOLL_ (daemon)); | 2896 | mhd_assert (! MHD_D_IS_USING_EPOLL_ (daemon)); |
2897 | if (! MHD_create_named_thread_ (&connection->tid, | 2897 | if (! MHD_create_named_thread_ (&connection->tid, |
@@ -2978,7 +2978,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, | |||
2978 | &connection->socket_context, | 2978 | &connection->socket_context, |
2979 | MHD_CONNECTION_NOTIFY_CLOSED); | 2979 | MHD_CONNECTION_NOTIFY_CLOSED); |
2980 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 2980 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
2981 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 2981 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
2982 | { | 2982 | { |
2983 | XDLL_remove (daemon->normal_timeout_head, | 2983 | XDLL_remove (daemon->normal_timeout_head, |
2984 | daemon->normal_timeout_tail, | 2984 | daemon->normal_timeout_tail, |
@@ -3189,7 +3189,7 @@ internal_suspend_connection_ (struct MHD_Connection *connection) | |||
3189 | 3189 | ||
3190 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 3190 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
3191 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ | 3191 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ |
3192 | (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ | 3192 | MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) || \ |
3193 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); | 3193 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); |
3194 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 3194 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
3195 | #endif | 3195 | #endif |
@@ -3202,7 +3202,7 @@ internal_suspend_connection_ (struct MHD_Connection *connection) | |||
3202 | #endif | 3202 | #endif |
3203 | return; | 3203 | return; |
3204 | } | 3204 | } |
3205 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 3205 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
3206 | { | 3206 | { |
3207 | if (connection->connection_timeout_ms == daemon->connection_timeout_ms) | 3207 | if (connection->connection_timeout_ms == daemon->connection_timeout_ms) |
3208 | XDLL_remove (daemon->normal_timeout_head, | 3208 | XDLL_remove (daemon->normal_timeout_head, |
@@ -3286,7 +3286,7 @@ MHD_suspend_connection (struct MHD_Connection *connection) | |||
3286 | 3286 | ||
3287 | #ifdef MHD_USE_THREADS | 3287 | #ifdef MHD_USE_THREADS |
3288 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ | 3288 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ |
3289 | (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ | 3289 | MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) || \ |
3290 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); | 3290 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); |
3291 | #endif /* MHD_USE_THREADS */ | 3291 | #endif /* MHD_USE_THREADS */ |
3292 | 3292 | ||
@@ -3496,7 +3496,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon) | |||
3496 | * Insert connection into cleanup list. */ | 3496 | * Insert connection into cleanup list. */ |
3497 | 3497 | ||
3498 | if ( (NULL != daemon->notify_completed) && | 3498 | if ( (NULL != daemon->notify_completed) && |
3499 | (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 3499 | (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) && |
3500 | (pos->rq.client_aware) ) | 3500 | (pos->rq.client_aware) ) |
3501 | { | 3501 | { |
3502 | daemon->notify_completed (daemon->notify_completed_cls, | 3502 | daemon->notify_completed (daemon->notify_completed_cls, |
@@ -3988,9 +3988,9 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
3988 | pos); | 3988 | pos); |
3989 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 3989 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
3990 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | 3990 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); |
3991 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 3991 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) && |
3992 | (! pos->thread_joined) && | 3992 | (! pos->thread_joined) && |
3993 | (! MHD_thread_handle_ID_join_thread_ (pos->tid)) ) | 3993 | (! MHD_thread_handle_ID_join_thread_ (pos->tid)) ) |
3994 | MHD_PANIC (_ ("Failed to join a thread.\n")); | 3994 | MHD_PANIC (_ ("Failed to join a thread.\n")); |
3995 | #endif | 3995 | #endif |
3996 | #ifdef UPGRADE_SUPPORT | 3996 | #ifdef UPGRADE_SUPPORT |
@@ -4166,7 +4166,7 @@ MHD_get_timeout64 (struct MHD_Daemon *daemon, | |||
4166 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); | 4166 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); |
4167 | #endif /* MHD_USE_THREADS */ | 4167 | #endif /* MHD_USE_THREADS */ |
4168 | 4168 | ||
4169 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 4169 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
4170 | { | 4170 | { |
4171 | #ifdef HAVE_MESSAGES | 4171 | #ifdef HAVE_MESSAGES |
4172 | MHD_DLOG (daemon, | 4172 | MHD_DLOG (daemon, |
@@ -4741,10 +4741,10 @@ MHD_select (struct MHD_Daemon *daemon, | |||
4741 | err_state = MHD_NO; | 4741 | err_state = MHD_NO; |
4742 | if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && | 4742 | if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && |
4743 | (MHD_NO != resume_suspended_connections (daemon)) && | 4743 | (MHD_NO != resume_suspended_connections (daemon)) && |
4744 | (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) | 4744 | (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) ) |
4745 | millisec = 0; | 4745 | millisec = 0; |
4746 | 4746 | ||
4747 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 4747 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
4748 | { | 4748 | { |
4749 | /* single-threaded, go over everything */ | 4749 | /* single-threaded, go over everything */ |
4750 | if (MHD_NO == | 4750 | if (MHD_NO == |
@@ -4842,7 +4842,7 @@ MHD_select (struct MHD_Daemon *daemon, | |||
4842 | uint64_t mhd_tmo; | 4842 | uint64_t mhd_tmo; |
4843 | uint64_t select_tmo; | 4843 | uint64_t select_tmo; |
4844 | 4844 | ||
4845 | if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 4845 | if ( (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) && |
4846 | (MHD_NO != MHD_get_timeout64 (daemon, &mhd_tmo)) ) | 4846 | (MHD_NO != MHD_get_timeout64 (daemon, &mhd_tmo)) ) |
4847 | { | 4847 | { |
4848 | if ( (0 < millisec) && | 4848 | if ( (0 < millisec) && |
@@ -5234,7 +5234,7 @@ static enum MHD_Result | |||
5234 | MHD_poll (struct MHD_Daemon *daemon, | 5234 | MHD_poll (struct MHD_Daemon *daemon, |
5235 | int may_block) | 5235 | int may_block) |
5236 | { | 5236 | { |
5237 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 5237 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
5238 | return MHD_poll_all (daemon, | 5238 | return MHD_poll_all (daemon, |
5239 | may_block ? -1 : 0); | 5239 | may_block ? -1 : 0); |
5240 | return MHD_poll_listen_socket (daemon, | 5240 | return MHD_poll_listen_socket (daemon, |
@@ -5886,7 +5886,7 @@ close_connection (struct MHD_Connection *pos) | |||
5886 | mhd_assert (NULL == daemon->worker_pool); | 5886 | mhd_assert (NULL == daemon->worker_pool); |
5887 | #endif /* MHD_USE_THREADS */ | 5887 | #endif /* MHD_USE_THREADS */ |
5888 | 5888 | ||
5889 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 5889 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
5890 | { | 5890 | { |
5891 | MHD_connection_mark_closed_ (pos); | 5891 | MHD_connection_mark_closed_ (pos); |
5892 | return; /* must let thread to do the rest */ | 5892 | return; /* must let thread to do the rest */ |
@@ -6671,7 +6671,7 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
6671 | #endif | 6671 | #endif |
6672 | return MHD_NO; | 6672 | return MHD_NO; |
6673 | } | 6673 | } |
6674 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 6674 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
6675 | { | 6675 | { |
6676 | #ifdef HAVE_MESSAGES | 6676 | #ifdef HAVE_MESSAGES |
6677 | MHD_DLOG (daemon, | 6677 | MHD_DLOG (daemon, |
@@ -7665,9 +7665,9 @@ MHD_start_daemon_va (unsigned int flags, | |||
7665 | } | 7665 | } |
7666 | #endif | 7666 | #endif |
7667 | 7667 | ||
7668 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 7668 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) |
7669 | && ((NULL != daemon->notify_completed) | 7669 | && ((NULL != daemon->notify_completed) |
7670 | || (NULL != daemon->notify_connection)) ) | 7670 | || (NULL != daemon->notify_connection)) ) |
7671 | *pflags |= MHD_USE_ITC; /* requires ITC */ | 7671 | *pflags |= MHD_USE_ITC; /* requires ITC */ |
7672 | 7672 | ||
7673 | #ifdef _DEBUG | 7673 | #ifdef _DEBUG |
@@ -8185,7 +8185,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
8185 | #endif | 8185 | #endif |
8186 | ) | 8186 | ) |
8187 | { | 8187 | { |
8188 | if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) | 8188 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
8189 | { | 8189 | { |
8190 | #ifdef HAVE_MESSAGES | 8190 | #ifdef HAVE_MESSAGES |
8191 | MHD_DLOG (daemon, | 8191 | MHD_DLOG (daemon, |
@@ -8271,8 +8271,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
8271 | goto free_and_fail; | 8271 | goto free_and_fail; |
8272 | } | 8272 | } |
8273 | if (! MHD_create_named_thread_ (&daemon->tid, | 8273 | if (! MHD_create_named_thread_ (&daemon->tid, |
8274 | (*pflags | 8274 | MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) ? |
8275 | & MHD_USE_THREAD_PER_CONNECTION) ? | ||
8276 | "MHD-listen" : "MHD-single", | 8275 | "MHD-listen" : "MHD-single", |
8277 | daemon->thread_stack_size, | 8276 | daemon->thread_stack_size, |
8278 | &MHD_polling_thread, | 8277 | &MHD_polling_thread, |
@@ -8569,8 +8568,7 @@ static void | |||
8569 | close_all_connections (struct MHD_Daemon *daemon) | 8568 | close_all_connections (struct MHD_Daemon *daemon) |
8570 | { | 8569 | { |
8571 | struct MHD_Connection *pos; | 8570 | struct MHD_Connection *pos; |
8572 | const bool used_thr_p_c = (0 != (daemon->options | 8571 | const bool used_thr_p_c = MHD_D_IS_USING_THREAD_PER_CONN_ (daemon); |
8573 | & MHD_USE_THREAD_PER_CONNECTION)); | ||
8574 | #ifdef UPGRADE_SUPPORT | 8572 | #ifdef UPGRADE_SUPPORT |
8575 | const bool upg_allowed = (0 != (daemon->options & MHD_ALLOW_UPGRADE)); | 8573 | const bool upg_allowed = (0 != (daemon->options & MHD_ALLOW_UPGRADE)); |
8576 | #endif /* UPGRADE_SUPPORT */ | 8574 | #endif /* UPGRADE_SUPPORT */ |
@@ -8582,7 +8580,7 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
8582 | 8580 | ||
8583 | #ifdef MHD_USE_THREADS | 8581 | #ifdef MHD_USE_THREADS |
8584 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ | 8582 | mhd_assert ( (! MHD_D_IS_USING_THREADS_ (daemon)) || \ |
8585 | (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ | 8583 | MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) || \ |
8586 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); | 8584 | MHD_thread_handle_ID_is_current_thread_ (daemon->tid) ); |
8587 | mhd_assert (NULL == daemon->worker_pool); | 8585 | mhd_assert (NULL == daemon->worker_pool); |
8588 | #endif /* MHD_USE_THREADS */ | 8586 | #endif /* MHD_USE_THREADS */ |
@@ -8710,9 +8708,9 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
8710 | shutdown (pos->socket_fd, | 8708 | shutdown (pos->socket_fd, |
8711 | SHUT_RDWR); | 8709 | SHUT_RDWR); |
8712 | #ifdef MHD_WINSOCK_SOCKETS | 8710 | #ifdef MHD_WINSOCK_SOCKETS |
8713 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 8711 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) && |
8714 | (MHD_ITC_IS_VALID_ (daemon->itc)) && | 8712 | (MHD_ITC_IS_VALID_ (daemon->itc)) && |
8715 | (! MHD_itc_activate_ (daemon->itc, "e")) ) | 8713 | (! MHD_itc_activate_ (daemon->itc, "e")) ) |
8716 | MHD_PANIC (_ ("Failed to signal shutdown via inter-thread " \ | 8714 | MHD_PANIC (_ ("Failed to signal shutdown via inter-thread " \ |
8717 | "communication channel.\n")); | 8715 | "communication channel.\n")); |
8718 | #endif | 8716 | #endif |
@@ -8760,8 +8758,8 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
8760 | while (NULL != (pos = daemon->connections_tail)) | 8758 | while (NULL != (pos = daemon->connections_tail)) |
8761 | { | 8759 | { |
8762 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 8760 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
8763 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 8761 | if (MHD_D_IS_USING_THREAD_PER_CONN_ (daemon) && |
8764 | (! pos->thread_joined) ) | 8762 | (! pos->thread_joined) ) |
8765 | MHD_PANIC (_ ("Failed to join a thread.\n")); | 8763 | MHD_PANIC (_ ("Failed to join a thread.\n")); |
8766 | #endif | 8764 | #endif |
8767 | close_connection (pos); | 8765 | close_connection (pos); |
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index fc1aaa00..c74415c6 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -1201,8 +1201,7 @@ MHD_send_sendfile_ (struct MHD_Connection *connection) | |||
1201 | #ifdef HAVE_DARWIN_SENDFILE | 1201 | #ifdef HAVE_DARWIN_SENDFILE |
1202 | off_t len; | 1202 | off_t len; |
1203 | #endif /* HAVE_DARWIN_SENDFILE */ | 1203 | #endif /* HAVE_DARWIN_SENDFILE */ |
1204 | const bool used_thr_p_c = (0 != (connection->daemon->options | 1204 | const bool used_thr_p_c = MHD_D_IS_USING_THREAD_PER_CONN_ (daemon); |
1205 | & MHD_USE_THREAD_PER_CONNECTION)); | ||
1206 | const size_t chunk_size = used_thr_p_c ? MHD_SENFILE_CHUNK_THR_P_C_ : | 1205 | const size_t chunk_size = used_thr_p_c ? MHD_SENFILE_CHUNK_THR_P_C_ : |
1207 | MHD_SENFILE_CHUNK_; | 1206 | MHD_SENFILE_CHUNK_; |
1208 | size_t send_size = 0; | 1207 | size_t send_size = 0; |
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 9a762159..9e9c0d73 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -2112,7 +2112,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response, | |||
2112 | urh->in_eready_list = true; | 2112 | urh->in_eready_list = true; |
2113 | } | 2113 | } |
2114 | #endif /* EPOLL_SUPPORT */ | 2114 | #endif /* EPOLL_SUPPORT */ |
2115 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION) ) | 2115 | if (! MHD_D_IS_USING_THREAD_PER_CONN_ (daemon)) |
2116 | { | 2116 | { |
2117 | /* This takes care of further processing for most event loops: | 2117 | /* This takes care of further processing for most event loops: |
2118 | simply add to DLL for bi-direcitonal processing */ | 2118 | simply add to DLL for bi-direcitonal processing */ |