mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
epoll is now supported on non-Linux platforms (namely illumos).
Renamed MHD options and updated documentation.
This commit is contained in:
+13
-13
@@ -168,9 +168,9 @@ thread-per-connection (MHD creates one listen thread and then one
|
||||
thread per accepted connection).
|
||||
|
||||
These thread modes are then combined with the event loop styles.
|
||||
MHD support select, poll and epoll. epoll is only available on
|
||||
Linux, poll may not be available on some platforms. Note that
|
||||
it is possible to combine MHD using epoll with an external
|
||||
MHD support select, poll and epoll. select is available on all
|
||||
platforms, epoll and poll may not be available on some platforms.
|
||||
Note that it is possible to combine MHD using epoll with an external
|
||||
select-based event loop.
|
||||
|
||||
The default (if no other option is passed) is ``external select''.
|
||||
@@ -203,8 +203,8 @@ request within the callbacks from MHD must use a thread per
|
||||
connection. This is typically rather costly. Applications that do
|
||||
not support threads or that must run on embedded devices without
|
||||
thread-support must use the external mode. Using @code{epoll} is only
|
||||
supported on Linux, thus portable applications must at least have a
|
||||
fallback option available. @ref{tbl:supported} lists the sane
|
||||
supported on some platform, thus portable applications must at least
|
||||
have a fallback option available. @ref{tbl:supported} lists the sane
|
||||
combinations.
|
||||
|
||||
@float Table,tbl:supported
|
||||
@@ -265,7 +265,7 @@ do not include the post processor API (results in binary incompatibility)
|
||||
do not include the authentication APIs (results in binary incompatibility)
|
||||
|
||||
@item ``--disable-epoll
|
||||
do not include epoll support, even on Linux (minimally smaller binary size, good for testing portability to non-Linux systems)
|
||||
do not include epoll support, even if it supported (minimally smaller binary size, good for portability testing)
|
||||
|
||||
@item ``--enable-coverage''
|
||||
set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries)
|
||||
@@ -504,15 +504,15 @@ conjunction with @code{MHD_USE_THREAD_PER_CONNECTION} or
|
||||
@code{MHD_USE_POLL} and the local platform does not support it,
|
||||
@code{MHD_start_daemon} will return NULL.
|
||||
|
||||
@item MHD_USE_EPOLL_LINUX_ONLY
|
||||
@item MHD_USE_EPOLL
|
||||
@cindex FD_SETSIZE
|
||||
@cindex epoll
|
||||
@cindex select
|
||||
Use @code{epoll()} instead of @code{poll()} or @code{select()}. This
|
||||
allows sockets with descriptors @code{>= FD_SETSIZE}. This option is
|
||||
only available on Linux systems and does not work in conjunction with
|
||||
only available on some systems and does not work in conjunction with
|
||||
@code{MHD_USE_THREAD_PER_CONNECTION} (at this point). If you specify
|
||||
@code{MHD_USE_EPOLL_LINUX_ONLY} and the local platform does not
|
||||
@code{MHD_USE_EPOLL} and the local platform does not
|
||||
support it, @code{MHD_start_daemon} will return NULL. Using
|
||||
@code{epoll()} instead of @code{select()} or @code{poll()} can in some
|
||||
situations result in significantly higher performance as the system
|
||||
@@ -524,7 +524,7 @@ open connections).
|
||||
@cindex performance
|
||||
Enable optimizations to aggressively improve performance. Note that
|
||||
the option is a slight misnomer, as these days it also enables optimziations
|
||||
that are unrelated to @code{MHD_USE_EPOLL_LINUX_ONLY}. Hence it is OK to
|
||||
that are unrelated to @code{MHD_USE_EPOLL}. Hence it is OK to
|
||||
use this option with other event loops.
|
||||
|
||||
Currently, the optimizations this option enables are based on
|
||||
@@ -2550,7 +2550,7 @@ No extra arguments should be passed.
|
||||
Request the file-descriptor number that MHD is using for epoll. If
|
||||
the build is not supporting epoll, NULL is returned; if we are using a
|
||||
thread pool or this daemon was not started with
|
||||
@code{MHD_USE_EPOLL_LINUX_ONLY}, (a pointer to) -1 is returned. If we are
|
||||
@code{MHD_USE_EPOLL}, (a pointer to) -1 is returned. If we are
|
||||
using @code{MHD_USE_SELECT_INTERNALLY} or are in 'external' select mode, the
|
||||
internal epoll FD is returned. This function must be used in external
|
||||
select mode with epoll to obtain the FD to call epoll on. No extra
|
||||
@@ -2763,8 +2763,8 @@ MHD_USE_POLL can be used.
|
||||
|
||||
@item MHD_FEATURE_EPOLL
|
||||
Get whether @code{epoll()} is supported. If supported then Flags
|
||||
MHD_USE_EPOLL_LINUX_ONLY and
|
||||
MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used.
|
||||
MHD_USE_EPOLL and
|
||||
MHD_USE_EPOLL_INTERNALLY can be used.
|
||||
|
||||
@item MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET
|
||||
Get whether shutdown on listen socket to signal other
|
||||
|
||||
@@ -136,7 +136,7 @@ main (int argc, char *const *argv)
|
||||
#endif
|
||||
d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_SUPPRESS_DATE_NO_CLOCK
|
||||
#ifdef EPOLL_SUPPORT
|
||||
| MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO
|
||||
| MHD_USE_EPOLL | MHD_USE_EPOLL_TURBO
|
||||
#endif
|
||||
,
|
||||
atoi (argv[1]),
|
||||
|
||||
@@ -182,7 +182,7 @@ main (int argc, char *const *argv)
|
||||
MHD_RESPMEM_PERSISTENT);
|
||||
d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL
|
||||
#ifdef EPOLL_SUPPORT
|
||||
| MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO
|
||||
| MHD_USE_EPOLL | MHD_USE_EPOLL_TURBO
|
||||
#endif
|
||||
,
|
||||
atoi (argv[1]),
|
||||
|
||||
+1
-1
@@ -885,7 +885,7 @@ main (int argc, char *const *argv)
|
||||
update_directory ();
|
||||
d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG
|
||||
#ifdef EPOLL_SUPPORT
|
||||
| MHD_USE_EPOLL_LINUX_ONLY
|
||||
| MHD_USE_EPOLL
|
||||
#endif
|
||||
,
|
||||
port,
|
||||
|
||||
@@ -934,7 +934,7 @@ main (int argc, char *const *argv)
|
||||
update_directory ();
|
||||
d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_SSL
|
||||
#ifdef EPOLL_SUPPORT
|
||||
| MHD_USE_EPOLL_LINUX_ONLY
|
||||
| MHD_USE_EPOLL
|
||||
#endif
|
||||
,
|
||||
port,
|
||||
|
||||
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t;
|
||||
* Current version of the library.
|
||||
* 0x01093001 = 1.9.30-1.
|
||||
*/
|
||||
#define MHD_VERSION 0x00095008
|
||||
#define MHD_VERSION 0x00095009
|
||||
|
||||
/**
|
||||
* MHD-internal return code for "YES".
|
||||
@@ -577,7 +577,7 @@ enum MHD_FLAG
|
||||
* FD_SETSIZE`. This option is not compatible with using an
|
||||
* 'external' `select()` mode (as there is no API to get the file
|
||||
* descriptors for the external select from MHD) and must also not
|
||||
* be used in combination with #MHD_USE_EPOLL_LINUX_ONLY.
|
||||
* be used in combination with #MHD_USE_EPOLL.
|
||||
*/
|
||||
MHD_USE_POLL = 64,
|
||||
|
||||
@@ -605,18 +605,29 @@ enum MHD_FLAG
|
||||
|
||||
/**
|
||||
* Use `epoll()` instead of `select()` or `poll()` for the event loop.
|
||||
* This option is only available on Linux; using the option on
|
||||
* non-Linux systems will cause #MHD_start_daemon to fail. Using
|
||||
* This option is only available on some systems; using the option on
|
||||
* systems without epoll will cause #MHD_start_daemon to fail. Using
|
||||
* this option is not supported with #MHD_USE_THREAD_PER_CONNECTION.
|
||||
* @sa ::MHD_FEATURE_EPOLL
|
||||
*/
|
||||
MHD_USE_EPOLL_LINUX_ONLY = 512,
|
||||
MHD_USE_EPOLL = 512,
|
||||
|
||||
/** @deprecated */
|
||||
#define MHD_USE_EPOLL_LINUX_ONLY \
|
||||
_MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_LINUX_ONLY is deprecated, use MHD_USE_EPOLL") \
|
||||
MHD_USE_EPOLL
|
||||
|
||||
/**
|
||||
* Run using an internal thread (or thread pool) doing `epoll()`.
|
||||
* This option is only available on Linux; using the option on
|
||||
* non-Linux systems will cause #MHD_start_daemon to fail.
|
||||
*/
|
||||
MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL_LINUX_ONLY,
|
||||
MHD_USE_EPOLL_INTERNALLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL,
|
||||
|
||||
/** @deprecated */
|
||||
#define MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY \
|
||||
_MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY is deprecated, use MHD_USE_EPOLL_INTERNALLY") \
|
||||
MHD_USE_EPOLL_INTERNALLY
|
||||
|
||||
/**
|
||||
* Force MHD to use a signal pipe to notify the event loop (of
|
||||
@@ -644,7 +655,7 @@ enum MHD_FLAG
|
||||
/**
|
||||
* Enable `epoll()` turbo. Disables certain calls to `shutdown()`
|
||||
* and enables aggressive non-blocking optimisitc reads.
|
||||
* Most effects only happen with #MHD_USE_EPOLL_LINUX_ONLY.
|
||||
* Most effects only happen with #MHD_USE_EPOLL.
|
||||
* Enalbed always on W32 as winsock does not properly behave
|
||||
* with `shutdown()` and this then fixes potential problems.
|
||||
*/
|
||||
@@ -2750,8 +2761,8 @@ enum MHD_FEATURE
|
||||
|
||||
/**
|
||||
* Get whether `epoll()` is supported. If supported then Flags
|
||||
* #MHD_USE_EPOLL_LINUX_ONLY and
|
||||
* #MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used.
|
||||
* #MHD_USE_EPOLL and
|
||||
* #MHD_USE_EPOLL_INTERNALLY can be used.
|
||||
*/
|
||||
MHD_FEATURE_EPOLL = 7,
|
||||
|
||||
|
||||
@@ -2895,7 +2895,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
|
||||
}
|
||||
MHD_connection_update_event_loop_info (connection);
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
switch (connection->event_loop_info)
|
||||
{
|
||||
@@ -2959,7 +2959,7 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection)
|
||||
{
|
||||
struct MHD_Daemon *daemon = connection->daemon;
|
||||
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) &&
|
||||
(0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) &&
|
||||
( (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY)) ||
|
||||
|
||||
+23
-23
@@ -664,7 +664,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
|
||||
|| (0 != (daemon->options & MHD_USE_POLL)))
|
||||
return MHD_NO;
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
/* we're in epoll mode, use the epoll FD as a stand-in for
|
||||
the entire event set */
|
||||
@@ -1240,7 +1240,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
|
||||
}
|
||||
|
||||
if ( (!MHD_SCKT_FD_FITS_FDSET_(client_socket, NULL)) &&
|
||||
(0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) )
|
||||
(0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) )
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
@@ -1486,7 +1486,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
|
||||
#endif
|
||||
}
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
if (0 == (daemon->options & MHD_USE_EPOLL_TURBO))
|
||||
{
|
||||
@@ -1611,7 +1611,7 @@ MHD_suspend_connection (struct MHD_Connection *connection)
|
||||
daemon->suspended_connections_tail,
|
||||
connection);
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
|
||||
{
|
||||
@@ -1729,7 +1729,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
|
||||
pos);
|
||||
}
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
|
||||
MHD_PANIC ("Resumed connection was already in EREADY set\n");
|
||||
@@ -1971,7 +1971,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
|
||||
MHD_CONNECTION_NOTIFY_CLOSED);
|
||||
MHD_ip_limit_del (daemon, pos->addr, pos->addr_len);
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
|
||||
{
|
||||
@@ -2138,7 +2138,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
|
||||
MHD_socket ds;
|
||||
struct MHD_Connection *pos;
|
||||
struct MHD_Connection *next;
|
||||
unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY |
|
||||
unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY |
|
||||
MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION;
|
||||
|
||||
/* drain signaling pipe to avoid spinning select */
|
||||
@@ -2153,7 +2153,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
|
||||
resume_suspended_connections (daemon);
|
||||
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
/* we're in epoll mode, the epoll FD stands for
|
||||
the entire event set! */
|
||||
@@ -2834,7 +2834,7 @@ MHD_run (struct MHD_Daemon *daemon)
|
||||
MHD_cleanup_connections (daemon);
|
||||
}
|
||||
#ifdef EPOLL_SUPPORT
|
||||
else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
else if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
{
|
||||
MHD_epoll (daemon, MHD_NO);
|
||||
MHD_cleanup_connections (daemon);
|
||||
@@ -2866,7 +2866,7 @@ MHD_select_thread (void *cls)
|
||||
if (0 != (daemon->options & MHD_USE_POLL))
|
||||
MHD_poll (daemon, MHD_YES);
|
||||
#ifdef EPOLL_SUPPORT
|
||||
else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
else if (0 != (daemon->options & MHD_USE_EPOLL))
|
||||
MHD_epoll (daemon, MHD_YES);
|
||||
#endif
|
||||
else
|
||||
@@ -2973,7 +2973,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
|
||||
{
|
||||
daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET;
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(-1 != daemon->worker_pool[i].epoll_fd) &&
|
||||
(MHD_YES == daemon->worker_pool[i].listen_socket_in_epoll) )
|
||||
{
|
||||
@@ -2994,7 +2994,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
|
||||
}
|
||||
daemon->socket_fd = MHD_INVALID_SOCKET;
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(-1 != daemon->epoll_fd) &&
|
||||
(MHD_YES == daemon->listen_socket_in_epoll) )
|
||||
{
|
||||
@@ -3628,7 +3628,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) &&
|
||||
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
|
||||
(1 == use_pipe) &&
|
||||
(!MHD_SCKT_FD_FITS_FDSET_(daemon->wpipe[0], NULL)) )
|
||||
{
|
||||
@@ -3974,7 +3974,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
"Failed to set nonblocking mode on listening socket: %s\n",
|
||||
MHD_socket_last_strerr_());
|
||||
#endif
|
||||
if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY) ||
|
||||
if (0 != (flags & MHD_USE_EPOLL) ||
|
||||
daemon->worker_pool_size > 0)
|
||||
{
|
||||
/* Accept must be non-blocking. Multiple children may wake up
|
||||
@@ -3986,7 +3986,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
}
|
||||
}
|
||||
if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd, NULL)) &&
|
||||
(0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) )
|
||||
(0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
@@ -4000,7 +4000,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
}
|
||||
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (flags & MHD_USE_EPOLL)) &&
|
||||
(0 == daemon->worker_pool_size) &&
|
||||
(0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) )
|
||||
{
|
||||
@@ -4008,7 +4008,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n");
|
||||
"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n");
|
||||
#endif
|
||||
goto free_and_fail;
|
||||
}
|
||||
@@ -4016,7 +4016,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
goto free_and_fail;
|
||||
}
|
||||
#else
|
||||
if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY))
|
||||
if (0 != (flags & MHD_USE_EPOLL))
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
@@ -4152,7 +4152,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) &&
|
||||
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
|
||||
(!MHD_SCKT_FD_FITS_FDSET_(d->wpipe[0], NULL)) )
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
@@ -4173,7 +4173,7 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
if (i < leftover_conns)
|
||||
++d->connection_limit;
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(MHD_YES != setup_epoll_to_listen (d)) )
|
||||
goto thread_failed;
|
||||
#endif
|
||||
@@ -4418,7 +4418,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
|
||||
daemon->worker_pool[i].shutdown = MHD_YES;
|
||||
daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET;
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(-1 != daemon->worker_pool[i].epoll_fd) &&
|
||||
(MHD_INVALID_SOCKET == fd) )
|
||||
epoll_shutdown (&daemon->worker_pool[i]);
|
||||
@@ -4440,7 +4440,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
|
||||
}
|
||||
#endif
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(-1 != daemon->epoll_fd) &&
|
||||
(MHD_INVALID_SOCKET == fd) )
|
||||
epoll_shutdown (daemon);
|
||||
@@ -4521,7 +4521,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
|
||||
}
|
||||
#endif
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) &&
|
||||
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
|
||||
(-1 != daemon->epoll_fd) &&
|
||||
(0 != MHD_socket_close_ (daemon->epoll_fd)) )
|
||||
MHD_PANIC ("close failed\n");
|
||||
|
||||
@@ -151,7 +151,7 @@ main (int argc, char *const *argv)
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, single client, epoll", &test_single_client,
|
||||
NULL,
|
||||
MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY,
|
||||
MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
srv_self_signed_cert_pem, MHD_OPTION_END);
|
||||
@@ -167,7 +167,7 @@ main (int argc, char *const *argv)
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, parallel clients, epoll",
|
||||
&test_parallel_clients, NULL,
|
||||
MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY,
|
||||
MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
srv_self_signed_cert_pem, MHD_OPTION_END);
|
||||
|
||||
@@ -224,7 +224,7 @@ main (int argc, char *const *argv)
|
||||
return -1;
|
||||
}
|
||||
#ifdef EPOLL_SUPPORT
|
||||
if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL_LINUX_ONLY)))
|
||||
if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL)))
|
||||
fprintf (stderr, "Fail: %d\n", errorCount);
|
||||
#endif
|
||||
if (0 != (errorCount = testExternalGet (0)))
|
||||
|
||||
@@ -227,7 +227,7 @@ testInternalGet (int port, int poll_flag)
|
||||
curl_easy_cleanup (c);
|
||||
}
|
||||
stop (poll_flag == MHD_USE_POLL ? "internal poll" :
|
||||
poll_flag == MHD_USE_EPOLL_LINUX_ONLY ? "internal epoll" : "internal select");
|
||||
poll_flag == MHD_USE_EPOLL ? "internal epoll" : "internal select");
|
||||
MHD_stop_daemon (d);
|
||||
if (cbc.pos != strlen ("/hello_world"))
|
||||
return 4;
|
||||
@@ -287,7 +287,7 @@ testMultithreadedGet (int port, int poll_flag)
|
||||
curl_easy_cleanup (c);
|
||||
}
|
||||
stop ((poll_flag & MHD_USE_POLL) ? "thread with poll" :
|
||||
(poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread with epoll" : "thread with select");
|
||||
(poll_flag & MHD_USE_EPOLL) ? "thread with epoll" : "thread with select");
|
||||
MHD_stop_daemon (d);
|
||||
if (cbc.pos != strlen ("/hello_world"))
|
||||
return 64;
|
||||
@@ -347,7 +347,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
|
||||
curl_easy_cleanup (c);
|
||||
}
|
||||
stop (0 != (poll_flag & MHD_USE_POLL) ? "thread pool with poll" :
|
||||
0 != (poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread pool with epoll" : "thread pool with select");
|
||||
0 != (poll_flag & MHD_USE_EPOLL) ? "thread pool with epoll" : "thread pool with select");
|
||||
MHD_stop_daemon (d);
|
||||
if (cbc.pos != strlen ("/hello_world"))
|
||||
return 64;
|
||||
@@ -527,8 +527,8 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
|
||||
{
|
||||
errorCount += testInternalGet(port++, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testInternalGet(port++, MHD_USE_EPOLL);
|
||||
errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL);
|
||||
}
|
||||
MHD_destroy_response (response);
|
||||
if (errorCount != 0)
|
||||
|
||||
@@ -399,8 +399,8 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
|
||||
{
|
||||
errorCount += testInternalGet (port++, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testMultithreadedPoolGet (port++, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testInternalGet (port++, MHD_USE_EPOLL);
|
||||
errorCount += testMultithreadedPoolGet (port++, MHD_USE_EPOLL);
|
||||
}
|
||||
MHD_destroy_response (response);
|
||||
if (errorCount != 0)
|
||||
|
||||
@@ -634,10 +634,10 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
|
||||
{
|
||||
errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testUnknownPortGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testEmptyGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testInternalGet(MHD_USE_EPOLL);
|
||||
errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL);
|
||||
errorCount += testUnknownPortGet(MHD_USE_EPOLL);
|
||||
errorCount += testEmptyGet(MHD_USE_EPOLL);
|
||||
}
|
||||
if (errorCount != 0)
|
||||
fprintf (stderr, "Error (code: %u)\n", errorCount);
|
||||
|
||||
@@ -482,8 +482,8 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
|
||||
{
|
||||
errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_EPOLL);
|
||||
errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_EPOLL);
|
||||
}
|
||||
if (errorCount != 0)
|
||||
fprintf (stderr, "Error (code: %u)\n", errorCount);
|
||||
|
||||
@@ -120,8 +120,8 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
|
||||
{
|
||||
errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY);
|
||||
errorCount += testInternalGet(MHD_USE_EPOLL);
|
||||
errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL);
|
||||
}
|
||||
if (errorCount != 0)
|
||||
fprintf (stderr, "Error (code: %u)\n", errorCount);
|
||||
|
||||
Reference in New Issue
Block a user