aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsilvioprog <silvioprog@gmail.com>2018-12-06 13:26:39 -0300
committersilvioprog <silvioprog@gmail.com>2018-12-06 13:26:39 -0300
commit22c08b5fd71091e84247f43bd36ce08184736f17 (patch)
tree963cf6621f22f66f8bfec57a619f6bdea8c1a537
parentb220303691d627ca3cfe0d949c6aa2257b722c60 (diff)
downloadlibmicrohttpd-22c08b5fd71091e84247f43bd36ce08184736f17.tar.gz
libmicrohttpd-22c08b5fd71091e84247f43bd36ce08184736f17.zip
Renamed all occurrences from _model(s)_ to _mode(s)_.
-rw-r--r--ChangeLog5
-rw-r--r--doc/libmicrohttpd.texi4
-rw-r--r--src/include/microhttpd.h4
-rw-r--r--src/include/microhttpd2.h18
-rw-r--r--src/lib/action_suspend.c2
-rw-r--r--src/lib/connection_add.c8
-rw-r--r--src/lib/connection_call_handlers.c12
-rw-r--r--src/lib/connection_cleanup.c2
-rw-r--r--src/lib/connection_finish_forward.c2
-rw-r--r--src/lib/connection_options.c4
-rw-r--r--src/lib/connection_update_last_activity.c2
-rw-r--r--src/lib/daemon_close_all_connections.c4
-rw-r--r--src/lib/daemon_destroy.c4
-rw-r--r--src/lib/daemon_get_timeout.c2
-rw-r--r--src/lib/daemon_info.c2
-rw-r--r--src/lib/daemon_options.c12
-rw-r--r--src/lib/daemon_poll.c4
-rw-r--r--src/lib/daemon_quiesce.c2
-rw-r--r--src/lib/daemon_run.c2
-rw-r--r--src/lib/daemon_select.c12
-rw-r--r--src/lib/daemon_start.c22
-rw-r--r--src/lib/internal.h4
-rw-r--r--src/lib/request_resume.c4
-rw-r--r--src/lib/upgrade_process.c2
-rw-r--r--src/microhttpd/daemon.c4
25 files changed, 73 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f27395d..9d7df977 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
1Thu Dec 6 13:25:08 BRT 2018
2 Renamed all occurrences from _model(s)_ to _mode(s)_. -SC
3
1Thu Dec 6 12:50:11 BRT 2018 4Thu Dec 6 12:50:11 BRT 2018
2 Optimized the function MHD_create_response_from_callback() for 5 Optimized the function MHD_create_response_from_callback() for
3 Windows by increasing its internal buffer size and allowed to customize 6 Windows by increasing its internal buffer size and allowed to customize
@@ -1762,7 +1765,7 @@ Tue May 29 13:55:03 CEST 2012
1762Tue May 29 13:45:15 CEST 2012 1765Tue May 29 13:45:15 CEST 2012
1763 Fixing bug where MHD failed to call connection termination callback 1766 Fixing bug where MHD failed to call connection termination callback
1764 if a connection either was closed due to read errors or if MHD 1767 if a connection either was closed due to read errors or if MHD
1765 was terminated with certain threading models. Added new 1768 was terminated with certain threading modes. Added new
1766 termination code MHD_REQUEST_TERMINATED_READ_ERROR for the 1769 termination code MHD_REQUEST_TERMINATED_READ_ERROR for the
1767 read-termination cause. -CG 1770 read-termination cause. -CG
1768 1771
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index d87dac76..7c573736 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -938,10 +938,10 @@ with the "--disable-messages" flag.
938@cindex performance 938@cindex performance
939Number (unsigned int) of threads in thread pool. Enable 939Number (unsigned int) of threads in thread pool. Enable
940thread pooling by setting this value to to something 940thread pooling by setting this value to to something
941greater than 1. Currently, thread model must be 941greater than 1. Currently, thread mode must be
942MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled 942MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled
943(@code{MHD_start_daemon} returns @code{NULL} for an unsupported thread 943(@code{MHD_start_daemon} returns @code{NULL} for an unsupported thread
944model). 944mode).
945 945
946@item MHD_OPTION_ARRAY 946@item MHD_OPTION_ARRAY
947@cindex options 947@cindex options
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 7eccccf2..61d1edef 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1340,10 +1340,10 @@ enum MHD_OPTION
1340 /** 1340 /**
1341 * Number (`unsigned int`) of threads in thread pool. Enable 1341 * Number (`unsigned int`) of threads in thread pool. Enable
1342 * thread pooling by setting this value to to something 1342 * thread pooling by setting this value to to something
1343 * greater than 1. Currently, thread model must be 1343 * greater than 1. Currently, thread mode must be
1344 * #MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled 1344 * #MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled
1345 * (#MHD_start_daemon returns NULL for an unsupported thread 1345 * (#MHD_start_daemon returns NULL for an unsupported thread
1346 * model). 1346 * mode).
1347 */ 1347 */
1348 MHD_OPTION_THREAD_POOL_SIZE = 14, 1348 MHD_OPTION_THREAD_POOL_SIZE = 14,
1349 1349
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index b7297fd3..5506d0c9 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -2266,9 +2266,9 @@ MHD_daemon_gnutls_key_and_cert_from_callback (struct MHD_Daemon *daemon,
2266 2266
2267 2267
2268/** 2268/**
2269 * Which threading model should be used by MHD? 2269 * Which threading mode should be used by MHD?
2270 */ 2270 */
2271enum MHD_ThreadingModel 2271enum MHD_ThreadingMode
2272{ 2272{
2273 2273
2274 /** 2274 /**
@@ -2306,21 +2306,21 @@ enum MHD_ThreadingModel
2306/** 2306/**
2307 * Use a thread pool of size @a n. 2307 * Use a thread pool of size @a n.
2308 * 2308 *
2309 * @return an `enum MHD_ThreadingModel` for a thread pool of size @a n 2309 * @return an `enum MHD_ThreadingMode` for a thread pool of size @a n
2310 */ 2310 */
2311#define MHD_TM_THREAD_POOL(n) ((enum MHD_ThreadingModel)(n)) 2311#define MHD_TM_THREAD_POOL(n) ((enum MHD_ThreadingMode)(n))
2312 2312
2313 2313
2314/** 2314/**
2315 * Specify threading model to use. 2315 * Specify threading mode to use.
2316 * 2316 *
2317 * @param daemon daemon to configure 2317 * @param daemon daemon to configure
2318 * @param tm model to use (positive values indicate the 2318 * @param tm mode to use (positive values indicate the
2319 * number of worker threads to be used) 2319 * number of worker threads to be used)
2320 */ 2320 */
2321_MHD_EXTERN void 2321_MHD_EXTERN void
2322MHD_daemon_threading_model (struct MHD_Daemon *daemon, 2322MHD_daemon_threading_mode (struct MHD_Daemon *daemon,
2323 enum MHD_ThreadingModel tm) 2323 enum MHD_ThreadingMode tm)
2324 MHD_NONNULL(1); 2324 MHD_NONNULL(1);
2325 2325
2326 2326
@@ -2470,7 +2470,7 @@ MHD_daemon_connection_memory_limit (struct MHD_Daemon *daemon,
2470 2470
2471/** 2471/**
2472 * Desired size of the stack for threads created by MHD. Use 0 for 2472 * Desired size of the stack for threads created by MHD. Use 0 for
2473 * system default. Only useful if the selected threading model 2473 * system default. Only useful if the selected threading mode
2474 * is not #MHD_TM_EXTERNAL_EVENT_LOOP. 2474 * is not #MHD_TM_EXTERNAL_EVENT_LOOP.
2475 * 2475 *
2476 * @param daemon daemon to configure 2476 * @param daemon daemon to configure
diff --git a/src/lib/action_suspend.c b/src/lib/action_suspend.c
index da27f124..bf5adc34 100644
--- a/src/lib/action_suspend.c
+++ b/src/lib/action_suspend.c
@@ -49,7 +49,7 @@ suspend_action (void *cls,
49 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 49 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
50 return MHD_SC_OK; 50 return MHD_SC_OK;
51 } 51 }
52 if (daemon->threading_model != MHD_TM_THREAD_PER_CONNECTION) 52 if (daemon->threading_mode != MHD_TM_THREAD_PER_CONNECTION)
53 { 53 {
54 if (connection->connection_timeout == 54 if (connection->connection_timeout ==
55 daemon->connection_default_timeout) 55 daemon->connection_default_timeout)
diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c
index b6f8f0ea..cd933d06 100644
--- a/src/lib/connection_add.c
+++ b/src/lib/connection_add.c
@@ -798,7 +798,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
798 goto cleanup; 798 goto cleanup;
799 } 799 }
800 daemon->connections++; 800 daemon->connections++;
801 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 801 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
802 { 802 {
803 XDLL_insert (daemon->normal_timeout_head, 803 XDLL_insert (daemon->normal_timeout_head,
804 daemon->normal_timeout_tail, 804 daemon->normal_timeout_tail,
@@ -815,7 +815,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
815 MHD_CONNECTION_NOTIFY_STARTED); 815 MHD_CONNECTION_NOTIFY_STARTED);
816 816
817 /* attempt to create handler thread */ 817 /* attempt to create handler thread */
818 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 818 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
819 { 819 {
820 if (! MHD_create_named_thread_ (&connection->pid, 820 if (! MHD_create_named_thread_ (&connection->pid,
821 "MHD-connection", 821 "MHD-connection",
@@ -876,7 +876,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
876 } 876 }
877 else /* This 'else' is combined with next 'if'. */ 877 else /* This 'else' is combined with next 'if'. */
878#endif 878#endif
879 if ( (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) && 879 if ( (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) &&
880 (external_add) && 880 (external_add) &&
881 (MHD_ITC_IS_VALID_(daemon->itc)) && 881 (MHD_ITC_IS_VALID_(daemon->itc)) &&
882 (! MHD_itc_activate_ (daemon->itc, 882 (! MHD_itc_activate_ (daemon->itc,
@@ -906,7 +906,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
906 addr, 906 addr,
907 addrlen); 907 addrlen);
908 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 908 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
909 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 909 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
910 { 910 {
911 XDLL_remove (daemon->normal_timeout_head, 911 XDLL_remove (daemon->normal_timeout_head,
912 daemon->normal_timeout_tail, 912 daemon->normal_timeout_tail,
diff --git a/src/lib/connection_call_handlers.c b/src/lib/connection_call_handlers.c
index 92b0e8f7..af8860d6 100644
--- a/src/lib/connection_call_handlers.c
+++ b/src/lib/connection_call_handlers.c
@@ -379,7 +379,7 @@ sendfile_adapter (struct MHD_Connection *connection)
379#ifdef HAVE_DARWIN_SENDFILE 379#ifdef HAVE_DARWIN_SENDFILE
380 off_t len; 380 off_t len;
381#endif /* HAVE_DARWIN_SENDFILE */ 381#endif /* HAVE_DARWIN_SENDFILE */
382 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model); 382 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode);
383 const size_t chunk_size = used_thr_p_c ? MHD_SENFILE_CHUNK_THR_P_C_ : MHD_SENFILE_CHUNK_; 383 const size_t chunk_size = used_thr_p_c ? MHD_SENFILE_CHUNK_THR_P_C_ : MHD_SENFILE_CHUNK_;
384 size_t send_size = 0; 384 size_t send_size = 0;
385 385
@@ -2754,7 +2754,7 @@ process_request_body (struct MHD_Request *request)
2754 /* client did not process all upload data, complain if 2754 /* client did not process all upload data, complain if
2755 the setup was incorrect, which may prevent us from 2755 the setup was incorrect, which may prevent us from
2756 handling the rest of the request */ 2756 handling the rest of the request */
2757 if ( (MHD_TM_EXTERNAL_EVENT_LOOP == daemon->threading_model) && 2757 if ( (MHD_TM_EXTERNAL_EVENT_LOOP == daemon->threading_mode) &&
2758 (! connection->suspended) ) 2758 (! connection->suspended) )
2759 MHD_DLOG (daemon, 2759 MHD_DLOG (daemon,
2760 MHD_SC_APPLICATION_HUNG_CONNECTION, 2760 MHD_SC_APPLICATION_HUNG_CONNECTION,
@@ -2810,7 +2810,7 @@ cleanup_connection (struct MHD_Connection *connection)
2810 } 2810 }
2811 else 2811 else
2812 { 2812 {
2813 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 2813 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
2814 { 2814 {
2815 if (connection->connection_timeout == 2815 if (connection->connection_timeout ==
2816 daemon->connection_default_timeout) 2816 daemon->connection_default_timeout)
@@ -2832,7 +2832,7 @@ cleanup_connection (struct MHD_Connection *connection)
2832 connection->resuming = false; 2832 connection->resuming = false;
2833 connection->request.in_idle = false; 2833 connection->request.in_idle = false;
2834 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 2834 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
2835 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 2835 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
2836 { 2836 {
2837 /* if we were at the connection limit before and are in 2837 /* if we were at the connection limit before and are in
2838 thread-per-connection mode, signal the main thread 2838 thread-per-connection mode, signal the main thread
@@ -2973,7 +2973,7 @@ connection_update_event_loop_info (struct MHD_Connection *connection)
2973 if (request->read_buffer_offset == request->read_buffer_size) 2973 if (request->read_buffer_offset == request->read_buffer_size)
2974 { 2974 {
2975 if ( (! try_grow_read_buffer (request)) && 2975 if ( (! try_grow_read_buffer (request)) &&
2976 (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) ) 2976 (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode) )
2977 { 2977 {
2978 /* failed to grow the read buffer, and the client 2978 /* failed to grow the read buffer, and the client
2979 which is supposed to handle the received data in 2979 which is supposed to handle the received data in
@@ -3675,7 +3675,7 @@ MHD_connection_call_handlers_ (struct MHD_Connection *con,
3675 * TLS read-ready connection in 'read info' state as connection 3675 * TLS read-ready connection in 'read info' state as connection
3676 * without space in read buffer will be market as 'info block'. */ 3676 * without space in read buffer will be market as 'info block'. */
3677 if ( (! daemon->data_already_pending) && 3677 if ( (! daemon->data_already_pending) &&
3678 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) ) 3678 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) )
3679 { 3679 {
3680 if (MHD_EVENT_LOOP_INFO_BLOCK == 3680 if (MHD_EVENT_LOOP_INFO_BLOCK ==
3681 con->request.event_loop_info) 3681 con->request.event_loop_info)
diff --git a/src/lib/connection_cleanup.c b/src/lib/connection_cleanup.c
index ca439299..8883213b 100644
--- a/src/lib/connection_cleanup.c
+++ b/src/lib/connection_cleanup.c
@@ -85,7 +85,7 @@ MHD_connection_cleanup_ (struct MHD_Daemon *daemon)
85 pos); 85 pos);
86 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 86 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
87 87
88 if ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) && 88 if ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode) &&
89 (! pos->thread_joined) && 89 (! pos->thread_joined) &&
90 (! MHD_join_thread_ (pos->pid.handle)) ) 90 (! MHD_join_thread_ (pos->pid.handle)) )
91 MHD_PANIC (_("Failed to join a thread\n")); 91 MHD_PANIC (_("Failed to join a thread\n"));
diff --git a/src/lib/connection_finish_forward.c b/src/lib/connection_finish_forward.c
index aac49f8c..335a03bf 100644
--- a/src/lib/connection_finish_forward.c
+++ b/src/lib/connection_finish_forward.c
@@ -45,7 +45,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
45 if (NULL == daemon->tls_api) 45 if (NULL == daemon->tls_api)
46 return; /* Nothing to do with non-TLS connection. */ 46 return; /* Nothing to do with non-TLS connection. */
47 47
48 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 48 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
49 DLL_remove (daemon->urh_head, 49 DLL_remove (daemon->urh_head,
50 daemon->urh_tail, 50 daemon->urh_tail,
51 urh); 51 urh);
diff --git a/src/lib/connection_options.c b/src/lib/connection_options.c
index cbcbf0bb..00652161 100644
--- a/src/lib/connection_options.c
+++ b/src/lib/connection_options.c
@@ -40,7 +40,7 @@ MHD_connection_set_timeout (struct MHD_Connection *connection,
40 struct MHD_Daemon *daemon = connection->daemon; 40 struct MHD_Daemon *daemon = connection->daemon;
41 41
42 connection->last_activity = MHD_monotonic_sec_counter(); 42 connection->last_activity = MHD_monotonic_sec_counter();
43 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 43 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
44 { 44 {
45 /* Simple case, no need to lock to update DLLs */ 45 /* Simple case, no need to lock to update DLLs */
46 connection->connection_timeout = (time_t) timeout_s; 46 connection->connection_timeout = (time_t) timeout_s;
@@ -96,7 +96,7 @@ MHD_update_last_activity_ (struct MHD_Connection *connection)
96 return; /* no activity on suspended connections */ 96 return; /* no activity on suspended connections */
97 97
98 connection->last_activity = MHD_monotonic_sec_counter(); 98 connection->last_activity = MHD_monotonic_sec_counter();
99 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 99 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
100 return; /* each connection has personal timeout */ 100 return; /* each connection has personal timeout */
101 101
102 if (connection->connection_timeout != 102 if (connection->connection_timeout !=
diff --git a/src/lib/connection_update_last_activity.c b/src/lib/connection_update_last_activity.c
index 435a783d..7253dc83 100644
--- a/src/lib/connection_update_last_activity.c
+++ b/src/lib/connection_update_last_activity.c
@@ -44,7 +44,7 @@ MHD_connection_update_last_activity_ (struct MHD_Connection *connection)
44 return; /* no activity on suspended connections */ 44 return; /* no activity on suspended connections */
45 45
46 connection->last_activity = MHD_monotonic_sec_counter(); 46 connection->last_activity = MHD_monotonic_sec_counter();
47 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 47 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
48 return; /* each connection has personal timeout */ 48 return; /* each connection has personal timeout */
49 49
50 if (connection->connection_timeout != daemon->connection_default_timeout) 50 if (connection->connection_timeout != daemon->connection_default_timeout)
diff --git a/src/lib/daemon_close_all_connections.c b/src/lib/daemon_close_all_connections.c
index 570def2c..d4b825da 100644
--- a/src/lib/daemon_close_all_connections.c
+++ b/src/lib/daemon_close_all_connections.c
@@ -44,7 +44,7 @@ close_connection (struct MHD_Connection *pos)
44{ 44{
45 struct MHD_Daemon *daemon = pos->daemon; 45 struct MHD_Daemon *daemon = pos->daemon;
46 46
47 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 47 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
48 { 48 {
49 MHD_connection_mark_closed_ (pos); 49 MHD_connection_mark_closed_ (pos);
50 return; /* must let thread to do the rest */ 50 return; /* must let thread to do the rest */
@@ -89,7 +89,7 @@ void
89MHD_daemon_close_all_connections_ (struct MHD_Daemon *daemon) 89MHD_daemon_close_all_connections_ (struct MHD_Daemon *daemon)
90{ 90{
91 struct MHD_Connection *pos; 91 struct MHD_Connection *pos;
92 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model); 92 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode);
93#ifdef UPGRADE_SUPPORT 93#ifdef UPGRADE_SUPPORT
94 const bool upg_allowed = (! daemon->disallow_upgrade); 94 const bool upg_allowed = (! daemon->disallow_upgrade);
95#endif /* UPGRADE_SUPPORT */ 95#endif /* UPGRADE_SUPPORT */
diff --git a/src/lib/daemon_destroy.c b/src/lib/daemon_destroy.c
index ae8c33d8..b4f34d16 100644
--- a/src/lib/daemon_destroy.c
+++ b/src/lib/daemon_destroy.c
@@ -39,7 +39,7 @@ stop_workers (struct MHD_Daemon *daemon)
39 unsigned int i; 39 unsigned int i;
40 40
41 mhd_assert (1 < daemon->worker_pool_size); 41 mhd_assert (1 < daemon->worker_pool_size);
42 mhd_assert (1 < daemon->threading_model); 42 mhd_assert (1 < daemon->threading_mode);
43 if (daemon->was_quiesced) 43 if (daemon->was_quiesced)
44 fd = MHD_INVALID_SOCKET; /* Do not use FD if daemon was quiesced */ 44 fd = MHD_INVALID_SOCKET; /* Do not use FD if daemon was quiesced */
45 else 45 else
@@ -111,7 +111,7 @@ MHD_daemon_destroy (struct MHD_Daemon *daemon)
111 { 111 {
112 mhd_assert (0 == daemon->worker_pool_size); 112 mhd_assert (0 == daemon->worker_pool_size);
113 /* Worker daemon or single-thread daemon. */ 113 /* Worker daemon or single-thread daemon. */
114 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) 114 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode)
115 { 115 {
116 /* Worker daemon or single daemon with internal thread(s). */ 116 /* Worker daemon or single daemon with internal thread(s). */
117 /* Separate thread(s) is used for polling sockets. */ 117 /* Separate thread(s) is used for polling sockets. */
diff --git a/src/lib/daemon_get_timeout.c b/src/lib/daemon_get_timeout.c
index 0e39ab4d..b0c7c8f7 100644
--- a/src/lib/daemon_get_timeout.c
+++ b/src/lib/daemon_get_timeout.c
@@ -53,7 +53,7 @@ MHD_daemon_get_timeout (struct MHD_Daemon *daemon,
53 struct MHD_Connection *pos; 53 struct MHD_Connection *pos;
54 bool have_timeout; 54 bool have_timeout;
55 55
56 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) 56 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode)
57 { 57 {
58#ifdef HAVE_MESSAGES 58#ifdef HAVE_MESSAGES
59 MHD_DLOG (daemon, 59 MHD_DLOG (daemon,
diff --git a/src/lib/daemon_info.c b/src/lib/daemon_info.c
index 37208da3..b0c5ec14 100644
--- a/src/lib/daemon_info.c
+++ b/src/lib/daemon_info.c
@@ -66,7 +66,7 @@ MHD_daemon_get_information_sz (struct MHD_Daemon *daemon,
66#endif 66#endif
67 case MHD_DAEMON_INFORMATION_CURRENT_CONNECTIONS: 67 case MHD_DAEMON_INFORMATION_CURRENT_CONNECTIONS:
68 CHECK_SIZE (unsigned int); 68 CHECK_SIZE (unsigned int);
69 if (MHD_TM_EXTERNAL_EVENT_LOOP == daemon->threading_model) 69 if (MHD_TM_EXTERNAL_EVENT_LOOP == daemon->threading_mode)
70 { 70 {
71 /* Assumes that MHD_run() in not called in other thread 71 /* Assumes that MHD_run() in not called in other thread
72 (of the application) at the same time. */ 72 (of the application) at the same time. */
diff --git a/src/lib/daemon_options.c b/src/lib/daemon_options.c
index 7839cad2..4d7bbdf1 100644
--- a/src/lib/daemon_options.c
+++ b/src/lib/daemon_options.c
@@ -533,17 +533,17 @@ MHD_daemon_gnutls_key_and_cert_from_callback (struct MHD_Daemon *daemon,
533 533
534 534
535/** 535/**
536 * Specify threading model to use. 536 * Specify threading mode to use.
537 * 537 *
538 * @param daemon daemon to configure 538 * @param daemon daemon to configure
539 * @param tm model to use (positive values indicate the 539 * @param tm mode to use (positive values indicate the
540 * number of worker threads to be used) 540 * number of worker threads to be used)
541 */ 541 */
542void 542void
543MHD_daemon_threading_model (struct MHD_Daemon *daemon, 543MHD_daemon_threading_mode (struct MHD_Daemon *daemon,
544 enum MHD_ThreadingModel tm) 544 enum MHD_ThreadingMode tm)
545{ 545{
546 daemon->threading_model = tm; 546 daemon->threading_mode = tm;
547} 547}
548 548
549 549
@@ -628,7 +628,7 @@ MHD_daemon_connection_memory_limit (struct MHD_Daemon *daemon,
628 628
629/** 629/**
630 * Desired size of the stack for threads created by MHD. Use 0 for 630 * Desired size of the stack for threads created by MHD. Use 0 for
631 * system default. Only useful if the selected threading model 631 * system default. Only useful if the selected threading mode
632 * is not #MHD_TM_EXTERNAL_EVENT_LOOP. 632 * is not #MHD_TM_EXTERNAL_EVENT_LOOP.
633 * 633 *
634 * @param daemon daemon to configure 634 * @param daemon daemon to configure
diff --git a/src/lib/daemon_poll.c b/src/lib/daemon_poll.c
index c9743543..80599e93 100644
--- a/src/lib/daemon_poll.c
+++ b/src/lib/daemon_poll.c
@@ -207,7 +207,7 @@ MHD_daemon_poll_all_ (struct MHD_Daemon *daemon,
207 } 207 }
208 if (! may_block) 208 if (! may_block)
209 timeout = 0; 209 timeout = 0;
210 else if ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) || 210 else if ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode) ||
211 (MHD_SC_OK != /* FIXME: distinguish between NO_TIMEOUT and errors! */ 211 (MHD_SC_OK != /* FIXME: distinguish between NO_TIMEOUT and errors! */
212 MHD_daemon_get_timeout (daemon, 212 MHD_daemon_get_timeout (daemon,
213 &ltimeout)) ) 213 &ltimeout)) )
@@ -444,7 +444,7 @@ MHD_daemon_poll_ (struct MHD_Daemon *daemon,
444#ifdef HAVE_POLL 444#ifdef HAVE_POLL
445 if (daemon->shutdown) 445 if (daemon->shutdown)
446 return MHD_SC_DAEMON_ALREADY_SHUTDOWN; 446 return MHD_SC_DAEMON_ALREADY_SHUTDOWN;
447 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 447 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
448 return MHD_daemon_poll_all_ (daemon, 448 return MHD_daemon_poll_all_ (daemon,
449 may_block); 449 may_block);
450 return MHD_daemon_poll_listen_socket_ (daemon, 450 return MHD_daemon_poll_listen_socket_ (daemon,
diff --git a/src/lib/daemon_quiesce.c b/src/lib/daemon_quiesce.c
index 5221b2cb..0d920608 100644
--- a/src/lib/daemon_quiesce.c
+++ b/src/lib/daemon_quiesce.c
@@ -53,7 +53,7 @@ MHD_daemon_quiesce (struct MHD_Daemon *daemon)
53 if (MHD_INVALID_SOCKET == (listen_socket = daemon->listen_socket)) 53 if (MHD_INVALID_SOCKET == (listen_socket = daemon->listen_socket))
54 return MHD_INVALID_SOCKET; 54 return MHD_INVALID_SOCKET;
55 if ( (daemon->disable_itc) && 55 if ( (daemon->disable_itc) &&
56 (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) ) 56 (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode) )
57 { 57 {
58#ifdef HAVE_MESSAGES 58#ifdef HAVE_MESSAGES
59 MHD_DLOG (daemon, 59 MHD_DLOG (daemon,
diff --git a/src/lib/daemon_run.c b/src/lib/daemon_run.c
index c9ed3720..3ce6a614 100644
--- a/src/lib/daemon_run.c
+++ b/src/lib/daemon_run.c
@@ -54,7 +54,7 @@ MHD_daemon_run (struct MHD_Daemon *daemon)
54 54
55 if (daemon->shutdown) 55 if (daemon->shutdown)
56 return MHD_SC_DAEMON_ALREADY_SHUTDOWN; 56 return MHD_SC_DAEMON_ALREADY_SHUTDOWN;
57 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) 57 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode)
58 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_EXTERNAL; 58 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_EXTERNAL;
59 switch (daemon->event_loop_syscall) 59 switch (daemon->event_loop_syscall)
60 { 60 {
diff --git a/src/lib/daemon_select.c b/src/lib/daemon_select.c
index 764f8008..07bd4e93 100644
--- a/src/lib/daemon_select.c
+++ b/src/lib/daemon_select.c
@@ -319,7 +319,7 @@ MHD_daemon_get_fdset2 (struct MHD_Daemon *daemon,
319 MHD_socket *max_fd, 319 MHD_socket *max_fd,
320 unsigned int fd_setsize) 320 unsigned int fd_setsize)
321{ 321{
322 if ( (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) || 322 if ( (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode) ||
323 (MHD_ELS_POLL == daemon->event_loop_syscall) ) 323 (MHD_ELS_POLL == daemon->event_loop_syscall) )
324 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_GET_FDSET; 324 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_GET_FDSET;
325 325
@@ -437,7 +437,7 @@ internal_run_from_select (struct MHD_Daemon *daemon,
437 read_fd_set)) ) 437 read_fd_set)) )
438 (void) MHD_accept_connection_ (daemon); 438 (void) MHD_accept_connection_ (daemon);
439 439
440 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 440 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
441 { 441 {
442 /* do not have a thread per connection, process all connections now */ 442 /* do not have a thread per connection, process all connections now */
443 prev = daemon->connections_tail; 443 prev = daemon->connections_tail;
@@ -608,7 +608,7 @@ MHD_daemon_run_from_select (struct MHD_Daemon *daemon,
608 const fd_set *write_fd_set, 608 const fd_set *write_fd_set,
609 const fd_set *except_fd_set) 609 const fd_set *except_fd_set)
610{ 610{
611 if ( (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_model) || 611 if ( (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode) ||
612 (MHD_ELS_POLL == daemon->event_loop_syscall) ) 612 (MHD_ELS_POLL == daemon->event_loop_syscall) )
613 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_SELECT; 613 return MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_SELECT;
614 if (MHD_ELS_EPOLL == daemon->event_loop_syscall) 614 if (MHD_ELS_EPOLL == daemon->event_loop_syscall)
@@ -671,10 +671,10 @@ MHD_daemon_select_ (struct MHD_Daemon *daemon,
671 sc = MHD_SC_OK; 671 sc = MHD_SC_OK;
672 if ( (! daemon->disallow_suspend_resume) && 672 if ( (! daemon->disallow_suspend_resume) &&
673 (MHD_resume_suspended_connections_ (daemon)) && 673 (MHD_resume_suspended_connections_ (daemon)) &&
674 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) ) 674 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) )
675 may_block = MHD_NO; 675 may_block = MHD_NO;
676 676
677 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) 677 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
678 { 678 {
679 679
680 /* single-threaded, go over everything */ 680 /* single-threaded, go over everything */
@@ -766,7 +766,7 @@ MHD_daemon_select_ (struct MHD_Daemon *daemon,
766 timeout.tv_sec = 0; 766 timeout.tv_sec = 0;
767 tv = &timeout; 767 tv = &timeout;
768 } 768 }
769 else if ( (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) && 769 else if ( (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) &&
770 (MHD_SC_OK == 770 (MHD_SC_OK ==
771 MHD_daemon_get_timeout (daemon, 771 MHD_daemon_get_timeout (daemon,
772 &ltimeout)) ) 772 &ltimeout)) )
diff --git a/src/lib/daemon_start.c b/src/lib/daemon_start.c
index 2596b725..2d44fe51 100644
--- a/src/lib/daemon_start.c
+++ b/src/lib/daemon_start.c
@@ -669,20 +669,20 @@ setup_thread_pool (struct MHD_Daemon *daemon)
669 * due to integer division). Also keep track of how many 669 * due to integer division). Also keep track of how many
670 * connections are leftover after an equal split. */ 670 * connections are leftover after an equal split. */
671 unsigned int conns_per_thread = daemon->global_connection_limit 671 unsigned int conns_per_thread = daemon->global_connection_limit
672 / daemon->threading_model; 672 / daemon->threading_mode;
673 unsigned int leftover_conns = daemon->global_connection_limit 673 unsigned int leftover_conns = daemon->global_connection_limit
674 % daemon->threading_model; 674 % daemon->threading_mode;
675 int i; 675 int i;
676 enum MHD_StatusCode sc; 676 enum MHD_StatusCode sc;
677 677
678 /* Allocate memory for pooled objects */ 678 /* Allocate memory for pooled objects */
679 daemon->worker_pool = MHD_calloc_ (daemon->threading_model, 679 daemon->worker_pool = MHD_calloc_ (daemon->threading_mode,
680 sizeof (struct MHD_Daemon)); 680 sizeof (struct MHD_Daemon));
681 if (NULL == daemon->worker_pool) 681 if (NULL == daemon->worker_pool)
682 return MHD_SC_THREAD_POOL_MALLOC_FAILURE; 682 return MHD_SC_THREAD_POOL_MALLOC_FAILURE;
683 683
684 /* Start the workers in the pool */ 684 /* Start the workers in the pool */
685 for (i = 0; i < daemon->threading_model; i++) 685 for (i = 0; i < daemon->threading_mode; i++)
686 { 686 {
687 /* Create copy of the Daemon object for each worker */ 687 /* Create copy of the Daemon object for each worker */
688 struct MHD_Daemon *d = &daemon->worker_pool[i]; 688 struct MHD_Daemon *d = &daemon->worker_pool[i];
@@ -691,7 +691,7 @@ setup_thread_pool (struct MHD_Daemon *daemon)
691 daemon, 691 daemon,
692 sizeof (struct MHD_Daemon)); 692 sizeof (struct MHD_Daemon));
693 /* Adjust pooling params for worker daemons; note that memcpy() 693 /* Adjust pooling params for worker daemons; note that memcpy()
694 has already copied MHD_USE_INTERNAL_POLLING_THREAD thread model into 694 has already copied MHD_USE_INTERNAL_POLLING_THREAD thread mode into
695 the worker threads. */ 695 the worker threads. */
696 d->master = daemon; 696 d->master = daemon;
697 d->worker_pool_size = 0; 697 d->worker_pool_size = 0;
@@ -822,7 +822,7 @@ MHD_daemon_start (struct MHD_Daemon *daemon)
822 /* We do not support thread-per-connection in combination 822 /* We do not support thread-per-connection in combination
823 with epoll, so use poll in this case, otherwise prefer 823 with epoll, so use poll in this case, otherwise prefer
824 epoll. */ 824 epoll. */
825 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 825 if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
826 daemon->event_loop_syscall = MHD_ELS_POLL; 826 daemon->event_loop_syscall = MHD_ELS_POLL;
827 else 827 else
828 daemon->event_loop_syscall = MHD_ELS_EPOLL; 828 daemon->event_loop_syscall = MHD_ELS_EPOLL;
@@ -837,7 +837,7 @@ MHD_daemon_start (struct MHD_Daemon *daemon)
837 if ( (MHD_ELS_EPOLL == daemon->event_loop_syscall) && 837 if ( (MHD_ELS_EPOLL == daemon->event_loop_syscall) &&
838 (0 == daemon->worker_pool_size) && 838 (0 == daemon->worker_pool_size) &&
839 (MHD_INVALID_SOCKET != daemon->listen_socket) && 839 (MHD_INVALID_SOCKET != daemon->listen_socket) &&
840 (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) ) 840 (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode) )
841 { 841 {
842#ifdef HAVE_MESSAGES 842#ifdef HAVE_MESSAGES
843 MHD_DLOG (daemon, 843 MHD_DLOG (daemon,
@@ -927,11 +927,11 @@ MHD_daemon_start (struct MHD_Daemon *daemon)
927 /* Setup main listen thread (only if we have no thread pool or 927 /* Setup main listen thread (only if we have no thread pool or
928 external event loop and do have a listen socket) */ 928 external event loop and do have a listen socket) */
929 /* FIXME: why no worker thread if we have no listen socket? */ 929 /* FIXME: why no worker thread if we have no listen socket? */
930 if ( ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) || 930 if ( ( (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode) ||
931 (1 == daemon->threading_model) ) && 931 (1 == daemon->threading_mode) ) &&
932 (MHD_INVALID_SOCKET != daemon->listen_socket) && 932 (MHD_INVALID_SOCKET != daemon->listen_socket) &&
933 (! MHD_create_named_thread_ (&daemon->pid, 933 (! MHD_create_named_thread_ (&daemon->pid,
934 (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model) 934 (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
935 ? "MHD-listen" 935 ? "MHD-listen"
936 : "MHD-single", 936 : "MHD-single",
937 daemon->thread_stack_limit_b, 937 daemon->thread_stack_limit_b,
@@ -949,7 +949,7 @@ MHD_daemon_start (struct MHD_Daemon *daemon)
949 949
950 /* Setup worker threads */ 950 /* Setup worker threads */
951 /* FIXME: why no thread pool if we have no listen socket? */ 951 /* FIXME: why no thread pool if we have no listen socket? */
952 if ( (1 < daemon->threading_model) && 952 if ( (1 < daemon->threading_mode) &&
953 (MHD_INVALID_SOCKET != daemon->listen_socket) && 953 (MHD_INVALID_SOCKET != daemon->listen_socket) &&
954 (MHD_SC_OK != (sc = setup_thread_pool (daemon))) ) 954 (MHD_SC_OK != (sc = setup_thread_pool (daemon))) )
955 return sc; 955 return sc;
diff --git a/src/lib/internal.h b/src/lib/internal.h
index 4e8a1470..c6d7bec6 100644
--- a/src/lib/internal.h
+++ b/src/lib/internal.h
@@ -1407,11 +1407,11 @@ struct MHD_Daemon
1407 struct MHD_itc_ itc; 1407 struct MHD_itc_ itc;
1408 1408
1409 /** 1409 /**
1410 * Which threading model do we use? Postive 1410 * Which threading mode do we use? Postive
1411 * numbers indicate the number of worker threads to be used. 1411 * numbers indicate the number of worker threads to be used.
1412 * Values larger than 1 imply a thread pool. 1412 * Values larger than 1 imply a thread pool.
1413 */ 1413 */
1414 enum MHD_ThreadingModel threading_model; 1414 enum MHD_ThreadingMode threading_mode;
1415 1415
1416 /** 1416 /**
1417 * When should we use TCP_FASTOPEN? 1417 * When should we use TCP_FASTOPEN?
diff --git a/src/lib/request_resume.c b/src/lib/request_resume.c
index 8fdffb87..a69107b9 100644
--- a/src/lib/request_resume.c
+++ b/src/lib/request_resume.c
@@ -80,7 +80,7 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon)
80 struct MHD_Connection *pos; 80 struct MHD_Connection *pos;
81 struct MHD_Connection *prev = NULL; 81 struct MHD_Connection *prev = NULL;
82 bool ret; 82 bool ret;
83 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model); 83 const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode);
84 84
85 mhd_assert (NULL == daemon->worker_pool); 85 mhd_assert (NULL == daemon->worker_pool);
86 ret = false; 86 ret = false;
@@ -162,7 +162,7 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon)
162 * application was closed upgraded connection. 162 * application was closed upgraded connection.
163 * Insert connection into cleanup list. */ 163 * Insert connection into cleanup list. */
164 if ( (NULL != response) && 164 if ( (NULL != response) &&
165 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) && 165 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) &&
166 (NULL != response->termination_cb) ) 166 (NULL != response->termination_cb) )
167 response->termination_cb (response->termination_cb_cls, 167 response->termination_cb (response->termination_cb_cls,
168 MHD_REQUEST_TERMINATED_COMPLETED_OK, 168 MHD_REQUEST_TERMINATED_COMPLETED_OK,
diff --git a/src/lib/upgrade_process.c b/src/lib/upgrade_process.c
index 318881ab..75924eee 100644
--- a/src/lib/upgrade_process.c
+++ b/src/lib/upgrade_process.c
@@ -358,7 +358,7 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
358 * and incoming forward buffer have some space. */ 358 * and incoming forward buffer have some space. */
359 if ( (connection->tls_read_ready) && 359 if ( (connection->tls_read_ready) &&
360 (urh->in_buffer_used < urh->in_buffer_size) && 360 (urh->in_buffer_used < urh->in_buffer_size) &&
361 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_model) ) 361 (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode) )
362 daemon->data_already_pending = true; 362 daemon->data_already_pending = true;
363 363
364 if ( (daemon->shutdown) && 364 if ( (daemon->shutdown) &&
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 12495841..7a310c1f 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5665,7 +5665,7 @@ MHD_start_daemon_va (unsigned int flags,
5665 } 5665 }
5666#endif 5666#endif
5667 5667
5668 /* Thread pooling currently works only with internal select thread model */ 5668 /* Thread pooling currently works only with internal select thread mode */
5669 if ( (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) && 5669 if ( (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) &&
5670 (daemon->worker_pool_size > 0) ) 5670 (daemon->worker_pool_size > 0) )
5671 { 5671 {
@@ -6135,7 +6135,7 @@ MHD_start_daemon_va (unsigned int flags,
6135 6135
6136 memcpy (d, daemon, sizeof (struct MHD_Daemon)); 6136 memcpy (d, daemon, sizeof (struct MHD_Daemon));
6137 /* Adjust pooling params for worker daemons; note that memcpy() 6137 /* Adjust pooling params for worker daemons; note that memcpy()
6138 has already copied MHD_USE_INTERNAL_POLLING_THREAD thread model into 6138 has already copied MHD_USE_INTERNAL_POLLING_THREAD thread mode into
6139 the worker threads. */ 6139 the worker threads. */
6140 d->master = daemon; 6140 d->master = daemon;
6141 d->worker_pool_size = 0; 6141 d->worker_pool_size = 0;