GNU libmicrohttpd 0.9.77
|
functions to start a daemon More...
#include "internal.h"
#include "connection_cleanup.h"
#include "daemon_close_all_connections.h"
#include "daemon_select.h"
#include "daemon_poll.h"
#include "daemon_epoll.h"
#include "request_resume.h"
Go to the source code of this file.
Functions | |
static enum MHD_StatusCode | configure_listen_reuse (struct MHD_Daemon *daemon) |
static enum MHD_StatusCode | open_listen_socket (struct MHD_Daemon *daemon) |
static void | get_listen_port_number (struct MHD_Daemon *daemon) |
static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ | MHD_polling_thread (void *cls) |
static enum MHD_StatusCode | setup_thread_pool (struct MHD_Daemon *daemon) |
enum MHD_StatusCode | MHD_daemon_start (struct MHD_Daemon *daemon) |
functions to start a daemon
Definition in file daemon_start.c.
|
static |
Set listen socket options to allow port rebinding (or not) depending on how MHD was configured.
[in,out] | daemon | the daemon with the listen socket to configure |
Definition at line 42 of file daemon_start.c.
References _, MHD_Daemon::allow_address_reuse, MHD_Daemon::listen_socket, and MHD_socket_last_strerr_.
Referenced by open_listen_socket().
|
static |
Obtain the listen port number from the socket (if it was not explicitly set by us, i.e. if we were given a listen socket or if the port was 0 and the OS picked a free one).
[in,out] | daemon | daemon to obtain the port number for |
Definition at line 422 of file daemon_start.c.
References _, MHD_Daemon::listen_port, MHD_Daemon::listen_socket, MHD_INVALID_SOCKET, and MHD_socket_last_strerr_.
Referenced by MHD_daemon_start().
|
static |
Thread that runs the polling loop until the daemon is explicitly shut down.
cls | struct MHD_Deamon to run select loop in a thread for |
Definition at line 619 of file daemon_start.c.
References MHD_Daemon::disallow_suspend_resume, MHD_Daemon::event_loop_syscall, MHD_connection_cleanup_(), MHD_daemon_close_all_connections_(), MHD_daemon_poll_(), MHD_daemon_select_(), MHD_PANIC, MHD_resume_suspended_connections_(), MHD_YES, MHD_Daemon::pid, and MHD_Daemon::shutdown.
Referenced by MHD_daemon_start(), MHD_start_daemon_va(), and setup_thread_pool().
|
static |
Open, configure and bind the listen socket (if required).
[in,out] | daemon | daemon to open the socket for |
Definition at line 157 of file daemon_start.c.
References _, configure_listen_reuse(), MHD_Daemon::fast_open_method, MHD_Daemon::fo_queue_length, MHD_Daemon::listen_af, MHD_Daemon::listen_backlog, MHD_Daemon::listen_port, MHD_Daemon::listen_sa, MHD_Daemon::listen_sa_len, MHD_Daemon::listen_socket, mhd_assert, MHD_INVALID_SOCKET, MHD_socket_create_listen_(), MHD_socket_last_strerr_, and UINT_MAX.
Referenced by MHD_daemon_start().
|
static |
Setup the thread pool (if needed).
[in,out] | daemon | daemon to setup thread pool for |
Definition at line 672 of file daemon_start.c.
References _, MHD_Daemon::cleanup_connection_mutex, MHD_Daemon::disable_itc, MHD_Daemon::event_loop_syscall, MHD_Daemon::global_connection_limit, MHD_Daemon::itc, MHD_Daemon::listen_socket, MHD_Daemon::master, MHD_calloc_(), MHD_create_named_thread_, MHD_daemon_quiesce(), MHD_itc_destroy_chk_, MHD_mutex_destroy_chk_, MHD_mutex_init_, MHD_polling_thread(), MHD_SCKT_FD_FITS_FDSET_, MHD_strerror_, NULL, MHD_Daemon::pid, MHD_Daemon::thread_stack_limit_b, MHD_Daemon::threading_mode, MHD_Daemon::worker_pool, and MHD_Daemon::worker_pool_size.
Referenced by MHD_daemon_start().