diff options
Diffstat (limited to 'src/lib/daemon_get_timeout.c')
-rw-r--r-- | src/lib/daemon_get_timeout.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/daemon_get_timeout.c b/src/lib/daemon_get_timeout.c new file mode 100644 index 00000000..fa3e39f9 --- /dev/null +++ b/src/lib/daemon_get_timeout.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file lib/daemon_get_timeout.c | ||
22 | * @brief function to obtain timeout for event loop | ||
23 | * @author Christian Grothoff | ||
24 | */ | ||
25 | #include "internal.h" | ||
26 | |||
27 | |||
28 | /** | ||
29 | * Obtain timeout value for polling function for this daemon. | ||
30 | * This function set value to amount of milliseconds for which polling | ||
31 | * function (`select()` or `poll()`) should at most block, not the | ||
32 | * timeout value set for connections. | ||
33 | * It is important to always use this function, even if connection | ||
34 | * timeout is not set, as in some cases MHD may already have more | ||
35 | * data to process on next turn (data pending in TLS buffers, | ||
36 | * connections are already ready with epoll etc.) and returned timeout | ||
37 | * will be zero. | ||
38 | * | ||
39 | * @param daemon daemon to query for timeout | ||
40 | * @param timeout set to the timeout (in milliseconds) | ||
41 | * @return #MHD_SC_OK on success, #MHD_SC_NO_TIMEOUT if timeouts are | ||
42 | * not used (or no connections exist that would | ||
43 | * necessitate the use of a timeout right now), otherwise | ||
44 | * an error code | ||
45 | * @ingroup event | ||
46 | */ | ||
47 | enum MHD_StatusCode | ||
48 | MHD_daemon_get_timeout (struct MHD_Daemon *daemon, | ||
49 | MHD_UNSIGNED_LONG_LONG *timeout) | ||
50 | { | ||
51 | return -1; | ||
52 | } | ||
53 | |||
54 | /* end of daemon_get_timeout.c */ | ||