diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-09-08 16:11:09 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-09-08 16:11:09 +0300 |
commit | 88faa63f22d9297d7d2f249ee9a642a64a5b48c7 (patch) | |
tree | d58fadce9f81a50d3fc9e7b023450ce93e22546b | |
parent | 12f65d40ac9a9351b26dc11d7dcd468a531dfe15 (diff) | |
download | libmicrohttpd-88faa63f22d9297d7d2f249ee9a642a64a5b48c7.tar.gz libmicrohttpd-88faa63f22d9297d7d2f249ee9a642a64a5b48c7.zip |
Updated doxy about MHD_get_timeout()
-rw-r--r-- | src/include/microhttpd.h | 29 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 45 |
2 files changed, 54 insertions, 20 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index f8210d9b..3f47e2f0 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -2227,6 +2227,8 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
2227 | * use external select with @code{select()} or with @code{epoll()}. | 2227 | * use external select with @code{select()} or with @code{epoll()}. |
2228 | * In the latter case, it will only add the single @code{epoll()} file | 2228 | * In the latter case, it will only add the single @code{epoll()} file |
2229 | * descriptor used by MHD to the sets. | 2229 | * descriptor used by MHD to the sets. |
2230 | * It's necessary to use #MHD_get_timeout() in combination with | ||
2231 | * this function. | ||
2230 | * | 2232 | * |
2231 | * This function must be called only for daemon started | 2233 | * This function must be called only for daemon started |
2232 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. | 2234 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. |
@@ -2264,6 +2266,8 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
2264 | * use external select with @code{select()} or with @code{epoll()}. | 2266 | * use external select with @code{select()} or with @code{epoll()}. |
2265 | * In the latter case, it will only add the single @code{epoll()} file | 2267 | * In the latter case, it will only add the single @code{epoll()} file |
2266 | * descriptor used by MHD to the sets. | 2268 | * descriptor used by MHD to the sets. |
2269 | * It's necessary to use #MHD_get_timeout() in combination with | ||
2270 | * this function. | ||
2267 | * | 2271 | * |
2268 | * This function must be called only for daemon started | 2272 | * This function must be called only for daemon started |
2269 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. | 2273 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. |
@@ -2296,6 +2300,8 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
2296 | * daemon FDs in fd_sets, call FD_ZERO for each fd_set | 2300 | * daemon FDs in fd_sets, call FD_ZERO for each fd_set |
2297 | * before calling this function. Size of fd_set is | 2301 | * before calling this function. Size of fd_set is |
2298 | * determined by current value of FD_SETSIZE. | 2302 | * determined by current value of FD_SETSIZE. |
2303 | * It's necessary to use #MHD_get_timeout() in combination with | ||
2304 | * this function. | ||
2299 | * | 2305 | * |
2300 | * This function could be called only for daemon started | 2306 | * This function could be called only for daemon started |
2301 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. | 2307 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. |
@@ -2317,17 +2323,21 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
2317 | 2323 | ||
2318 | 2324 | ||
2319 | /** | 2325 | /** |
2320 | * Obtain timeout value for `select()` for this daemon (only needed if | 2326 | * Obtain timeout value for polling function for this daemon. |
2321 | * connection timeout is used). The returned value is how many milliseconds | 2327 | * This function set value to amount of milliseconds for which polling |
2322 | * `select()` or `poll()` should at most block, not the timeout value set for | 2328 | * function (`select()` or `poll()`) should at most block, not the |
2323 | * connections. This function MUST NOT be called if MHD is running with | 2329 | * timeout value set for connections. |
2324 | * #MHD_USE_THREAD_PER_CONNECTION. | 2330 | * It is important to always use this function, even if connection |
2331 | * timeout is not set, as in some cases MHD may already have more | ||
2332 | * data to process on next turn (data pending in TLS buffers, | ||
2333 | * connections are already ready with epoll etc.) and returned timeout | ||
2334 | * will be zero. | ||
2325 | * | 2335 | * |
2326 | * @param daemon daemon to query for timeout | 2336 | * @param daemon daemon to query for timeout |
2327 | * @param timeout set to the timeout (in milliseconds) | 2337 | * @param timeout set to the timeout (in milliseconds) |
2328 | * @return #MHD_YES on success, #MHD_NO if timeouts are | 2338 | * @return #MHD_YES on success, #MHD_NO if timeouts are |
2329 | * not used (or no connections exist that would | 2339 | * not used (or no connections exist that would |
2330 | * necessiate the use of a timeout right now). | 2340 | * necessitate the use of a timeout right now). |
2331 | * @ingroup event | 2341 | * @ingroup event |
2332 | */ | 2342 | */ |
2333 | _MHD_EXTERN int | 2343 | _MHD_EXTERN int |
@@ -2338,7 +2348,8 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
2338 | /** | 2348 | /** |
2339 | * Run webserver operations (without blocking unless in client | 2349 | * Run webserver operations (without blocking unless in client |
2340 | * callbacks). This method should be called by clients in combination | 2350 | * callbacks). This method should be called by clients in combination |
2341 | * with #MHD_get_fdset if the client-controlled select method is used. | 2351 | * with #MHD_get_fdset if the client-controlled select method is used and |
2352 | * #MHD_get_timeout(). | ||
2342 | * | 2353 | * |
2343 | * This function is a convenience method, which is useful if the | 2354 | * This function is a convenience method, which is useful if the |
2344 | * fd_sets from #MHD_get_fdset were not directly passed to `select()`; | 2355 | * fd_sets from #MHD_get_fdset were not directly passed to `select()`; |
@@ -2360,8 +2371,8 @@ MHD_run (struct MHD_Daemon *daemon); | |||
2360 | 2371 | ||
2361 | /** | 2372 | /** |
2362 | * Run webserver operations. This method should be called by clients | 2373 | * Run webserver operations. This method should be called by clients |
2363 | * in combination with #MHD_get_fdset if the client-controlled select | 2374 | * in combination with #MHD_get_fdset and #MHD_get_timeout() if the |
2364 | * method is used. | 2375 | * client-controlled select method is used. |
2365 | * | 2376 | * |
2366 | * You can use this function instead of #MHD_run if you called | 2377 | * You can use this function instead of #MHD_run if you called |
2367 | * `select()` on the result from #MHD_get_fdset. File descriptors in | 2378 | * `select()` on the result from #MHD_get_fdset. File descriptors in |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 51b05d8e..18bfc7a8 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -557,6 +557,16 @@ MHD_TLS_init (struct MHD_Daemon *daemon) | |||
557 | * before calling this function. FD_SETSIZE is assumed | 557 | * before calling this function. FD_SETSIZE is assumed |
558 | * to be platform's default. | 558 | * to be platform's default. |
559 | * | 559 | * |
560 | * This function should only be called in when MHD is configured to | ||
561 | * use external select with @code{select()} or with @code{epoll()}. | ||
562 | * In the latter case, it will only add the single @code{epoll()} file | ||
563 | * descriptor used by MHD to the sets. | ||
564 | * It's necessary to use #MHD_get_timeout() in combination with | ||
565 | * this function. | ||
566 | * | ||
567 | * This function must be called only for daemon started | ||
568 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. | ||
569 | * | ||
560 | * @param daemon daemon to get sets from | 570 | * @param daemon daemon to get sets from |
561 | * @param read_fd_set read set | 571 | * @param read_fd_set read set |
562 | * @param write_fd_set write set | 572 | * @param write_fd_set write set |
@@ -939,9 +949,17 @@ internal_get_fdset2 (struct MHD_Daemon *daemon, | |||
939 | * Obtain the `select()` sets for this daemon. | 949 | * Obtain the `select()` sets for this daemon. |
940 | * Daemon's FDs will be added to fd_sets. To get only | 950 | * Daemon's FDs will be added to fd_sets. To get only |
941 | * daemon FDs in fd_sets, call FD_ZERO for each fd_set | 951 | * daemon FDs in fd_sets, call FD_ZERO for each fd_set |
942 | * before calling this function. Passing custom FD_SETSIZE | 952 | * before calling this function. |
943 | * as @a fd_setsize allow usage of larger/smaller than | 953 | * |
944 | * platform's default fd_sets. | 954 | * Passing custom FD_SETSIZE as @a fd_setsize allow usage of |
955 | * larger/smaller than platform's default fd_sets. | ||
956 | * | ||
957 | * This function should only be called in when MHD is configured to | ||
958 | * use external select with @code{select()} or with @code{epoll()}. | ||
959 | * In the latter case, it will only add the single @code{epoll()} file | ||
960 | * descriptor used by MHD to the sets. | ||
961 | * It's necessary to use #MHD_get_timeout() in combination with | ||
962 | * this function. | ||
945 | * | 963 | * |
946 | * This function must be called only for daemon started | 964 | * This function must be called only for daemon started |
947 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. | 965 | * without #MHD_USE_INTERNAL_POLLING_THREAD flag. |
@@ -3032,11 +3050,15 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
3032 | 3050 | ||
3033 | 3051 | ||
3034 | /** | 3052 | /** |
3035 | * Obtain timeout value for `select()` for this daemon (only needed if | 3053 | * Obtain timeout value for polling function for this daemon. |
3036 | * connection timeout is used). The returned value is how long | 3054 | * This function set value to amount of milliseconds for which polling |
3037 | * `select()` or `poll()` should at most block, not the timeout value set | 3055 | * function (`select()` or `poll()`) should at most block, not the |
3038 | * for connections. This function MUST NOT be called if MHD is | 3056 | * timeout value set for connections. |
3039 | * running with #MHD_USE_THREAD_PER_CONNECTION. | 3057 | * It is important to always use this function, even if connection |
3058 | * timeout is not set as in some cases MHD may already have more | ||
3059 | * data to process on next turn (data pending in TLS buffers, | ||
3060 | * connections are already ready with epoll etc.) and returned timeout | ||
3061 | * will be zero. | ||
3040 | * @remark To be called only from thread that process | 3062 | * @remark To be called only from thread that process |
3041 | * daemon's select()/poll()/etc. | 3063 | * daemon's select()/poll()/etc. |
3042 | * | 3064 | * |
@@ -3220,8 +3242,8 @@ internal_run_from_select (struct MHD_Daemon *daemon, | |||
3220 | 3242 | ||
3221 | /** | 3243 | /** |
3222 | * Run webserver operations. This method should be called by clients | 3244 | * Run webserver operations. This method should be called by clients |
3223 | * in combination with #MHD_get_fdset if the client-controlled select | 3245 | * in combination with #MHD_get_fdset and #MHD_get_timeout() if the |
3224 | * method is used. | 3246 | * client-controlled select method is used. |
3225 | * | 3247 | * |
3226 | * You can use this function instead of #MHD_run if you called | 3248 | * You can use this function instead of #MHD_run if you called |
3227 | * `select()` on the result from #MHD_get_fdset. File descriptors in | 3249 | * `select()` on the result from #MHD_get_fdset. File descriptors in |
@@ -4242,7 +4264,8 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
4242 | /** | 4264 | /** |
4243 | * Run webserver operations (without blocking unless in client | 4265 | * Run webserver operations (without blocking unless in client |
4244 | * callbacks). This method should be called by clients in combination | 4266 | * callbacks). This method should be called by clients in combination |
4245 | * with #MHD_get_fdset if the client-controlled select method is used. | 4267 | * with #MHD_get_fdset if the client-controlled select method is used and |
4268 | * #MHD_get_timeout(). | ||
4246 | * | 4269 | * |
4247 | * This function is a convenience method, which is useful if the | 4270 | * This function is a convenience method, which is useful if the |
4248 | * fd_sets from #MHD_get_fdset were not directly passed to `select()`; | 4271 | * fd_sets from #MHD_get_fdset were not directly passed to `select()`; |