diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 45 |
1 files changed, 34 insertions, 11 deletions
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()`; |