aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/libmicrohttpd.texi13
-rw-r--r--src/include/microhttpd.h41
-rw-r--r--src/microhttpd/daemon.c13
3 files changed, 47 insertions, 20 deletions
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index dba1d08f..82d9f415 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1594,6 +1594,15 @@ is added to @var{read_fd_set}. The list of currently existent
1594connections is scanned and their file descriptors added to the correct 1594connections is scanned and their file descriptors added to the correct
1595set. 1595set.
1596 1596
1597When calling this function, FD_SETSIZE is assumed to be platform's
1598default. If you changed FD_SETSIZE for your application,
1599you should use @code{MHD_get_fdset2()} instead.
1600
1601This function should only be called in when MHD is configured to use
1602external select with @code{select()} or with @code{epoll()}. In
1603the latter case, it will only add the single @code{epoll()} file
1604descriptor used by MHD to the sets.
1605
1597After the call completed successfully: the variable referenced by 1606After the call completed successfully: the variable referenced by
1598@var{max_fd} references the file descriptor with highest integer 1607@var{max_fd} references the file descriptor with highest integer
1599identifier. The variable must be set to zero before invoking this 1608identifier. The variable must be set to zero before invoking this
@@ -1605,6 +1614,10 @@ the right options for this call.
1605@end deftypefun 1614@end deftypefun
1606 1615
1607 1616
1617@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize)
1618Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application.
1619
1620
1608@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) 1621@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)
1609@cindex timeout 1622@cindex timeout
1610Obtain timeout value for select for this daemon (only needed if 1623Obtain timeout value for select for this daemon (only needed if
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index a09cddf3..40545452 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -2178,8 +2178,13 @@ MHD_add_connection (struct MHD_Daemon *daemon,
2178 * before calling this function. FD_SETSIZE is assumed 2178 * before calling this function. FD_SETSIZE is assumed
2179 * to be platform's default. 2179 * to be platform's default.
2180 * 2180 *
2181 * This function could be called only for daemon started 2181 * This function should only be called in when MHD is configured to
2182 * without MHD_USE_INTERNAL_POLLING_THREAD flag. 2182 * use external select with @code{select()} or with @code{epoll()}.
2183 * In the latter case, it will only add the single @code{epoll()} file
2184 * descriptor used by MHD to the sets.
2185 *
2186 * This function must be called only for daemon started
2187 * without #MHD_USE_INTERNAL_POLLING_THREAD flag.
2183 * 2188 *
2184 * @param daemon daemon to get sets from 2189 * @param daemon daemon to get sets from
2185 * @param read_fd_set read set 2190 * @param read_fd_set read set
@@ -2205,12 +2210,18 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2205 * Obtain the `select()` sets for this daemon. 2210 * Obtain the `select()` sets for this daemon.
2206 * Daemon's FDs will be added to fd_sets. To get only 2211 * Daemon's FDs will be added to fd_sets. To get only
2207 * daemon FDs in fd_sets, call FD_ZERO for each fd_set 2212 * daemon FDs in fd_sets, call FD_ZERO for each fd_set
2208 * before calling this function. Passing custom FD_SETSIZE 2213 * before calling this function.
2209 * as @a fd_setsize allow usage of larger/smaller than
2210 * platform's default fd_sets.
2211 * 2214 *
2212 * This function could be called only for daemon started 2215 * Passing custom FD_SETSIZE as @a fd_setsize allow usage of
2213 * without MHD_USE_INTERNAL_POLLING_THREAD flag. 2216 * larger/smaller than platform's default fd_sets.
2217 *
2218 * This function should only be called in when MHD is configured to
2219 * use external select with @code{select()} or with @code{epoll()}.
2220 * In the latter case, it will only add the single @code{epoll()} file
2221 * descriptor used by MHD to the sets.
2222 *
2223 * This function must be called only for daemon started
2224 * without #MHD_USE_INTERNAL_POLLING_THREAD flag.
2214 * 2225 *
2215 * @param daemon daemon to get sets from 2226 * @param daemon daemon to get sets from
2216 * @param read_fd_set read set 2227 * @param read_fd_set read set
@@ -2227,11 +2238,11 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2227 */ 2238 */
2228_MHD_EXTERN int 2239_MHD_EXTERN int
2229MHD_get_fdset2 (struct MHD_Daemon *daemon, 2240MHD_get_fdset2 (struct MHD_Daemon *daemon,
2230 fd_set *read_fd_set, 2241 fd_set *read_fd_set,
2231 fd_set *write_fd_set, 2242 fd_set *write_fd_set,
2232 fd_set *except_fd_set, 2243 fd_set *except_fd_set,
2233 MHD_socket *max_fd, 2244 MHD_socket *max_fd,
2234 unsigned int fd_setsize); 2245 unsigned int fd_setsize);
2235 2246
2236 2247
2237/** 2248/**
@@ -2242,7 +2253,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2242 * determined by current value of FD_SETSIZE. 2253 * determined by current value of FD_SETSIZE.
2243 * 2254 *
2244 * This function could be called only for daemon started 2255 * This function could be called only for daemon started
2245 * without MHD_USE_INTERNAL_POLLING_THREAD flag. 2256 * without #MHD_USE_INTERNAL_POLLING_THREAD flag.
2246 * 2257 *
2247 * @param daemon daemon to get sets from 2258 * @param daemon daemon to get sets from
2248 * @param read_fd_set read set 2259 * @param read_fd_set read set
@@ -2288,7 +2299,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
2288 * fd_sets from #MHD_get_fdset were not directly passed to `select()`; 2299 * fd_sets from #MHD_get_fdset were not directly passed to `select()`;
2289 * with this function, MHD will internally do the appropriate `select()` 2300 * with this function, MHD will internally do the appropriate `select()`
2290 * call itself again. While it is always safe to call #MHD_run (if 2301 * call itself again. While it is always safe to call #MHD_run (if
2291 * ::MHD_USE_INTERNAL_POLLING_THREAD is not set), you should call 2302 * #MHD_USE_INTERNAL_POLLING_THREAD is not set), you should call
2292 * #MHD_run_from_select if performance is important (as it saves an 2303 * #MHD_run_from_select if performance is important (as it saves an
2293 * expensive call to `select()`). 2304 * expensive call to `select()`).
2294 * 2305 *
@@ -2315,7 +2326,7 @@ MHD_run (struct MHD_Daemon *daemon);
2315 * ready. 2326 * ready.
2316 * 2327 *
2317 * This function cannot be used with daemon started with 2328 * This function cannot be used with daemon started with
2318 * MHD_USE_INTERNAL_POLLING_THREAD flag. 2329 * #MHD_USE_INTERNAL_POLLING_THREAD flag.
2319 * 2330 *
2320 * @param daemon daemon to run select loop for 2331 * @param daemon daemon to run select loop for
2321 * @param read_fd_set read set 2332 * @param read_fd_set read set
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 991577b1..d1ec032a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1046,8 +1046,8 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
1046 * as @a fd_setsize allow usage of larger/smaller than 1046 * as @a fd_setsize allow usage of larger/smaller than
1047 * platform's default fd_sets. 1047 * platform's default fd_sets.
1048 * 1048 *
1049 * This function could be called only for daemon started 1049 * This function must be called only for daemon started
1050 * without MHD_USE_INTERNAL_POLLING_THREAD flag. 1050 * without #MHD_USE_INTERNAL_POLLING_THREAD flag.
1051 * 1051 *
1052 * @param daemon daemon to get sets from 1052 * @param daemon daemon to get sets from
1053 * @param read_fd_set read set 1053 * @param read_fd_set read set
@@ -1106,9 +1106,12 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
1106 } 1106 }
1107#endif 1107#endif
1108 1108
1109 return internal_get_fdset2 (daemon, read_fd_set, 1109 return internal_get_fdset2 (daemon,
1110 write_fd_set, except_fd_set, 1110 read_fd_set,
1111 max_fd, fd_setsize); 1111 write_fd_set,
1112 except_fd_set,
1113 max_fd,
1114 fd_setsize);
1112} 1115}
1113 1116
1114 1117