GNU libmicrohttpd  0.9.72
daemon_start.c File Reference

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"
Include dependency graph for daemon_start.c:

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)
 

Detailed Description

functions to start a daemon

Author
Christian Grothoff

Definition in file daemon_start.c.

Function Documentation

◆ configure_listen_reuse()

static enum MHD_StatusCode configure_listen_reuse ( struct MHD_Daemon daemon)
static

Set listen socket options to allow port rebinding (or not) depending on how MHD was configured.

Parameters
[in,out]daemonthe daemon with the listen socket to configure
Returns
#MHD_SC_OK on success (or non-fatal errors)

Definition at line 1 of file daemon_start.c.

References _, MHD_Daemon::allow_address_reuse, MHD_Daemon::listen_socket, and MHD_socket_last_strerr_.

◆ get_listen_port_number()

static void get_listen_port_number ( struct MHD_Daemon daemon)
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).

Parameters
[in,out]daemondaemon 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_.

◆ MHD_polling_thread()

static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ MHD_polling_thread ( void *  cls)
static

Thread that runs the polling loop until the daemon is explicitly shut down.

Parameters
clsstruct MHD_Deamon to run select loop in a thread for
Returns
always 0 (on shutdown)

Definition at line 619 of file daemon_start.c.

Referenced by MHD_start_daemon_va().

Here is the caller graph for this function:

◆ open_listen_socket()

static enum MHD_StatusCode open_listen_socket ( struct MHD_Daemon daemon)
static

Open, configure and bind the listen socket (if required).

Parameters
[in,out]daemondaemon to open the socket for
Returns
#MHD_SC_OK on success

Definition at line 1 of file daemon_start.c.

◆ setup_thread_pool()

static enum MHD_StatusCode setup_thread_pool ( struct MHD_Daemon daemon)
static

Setup the thread pool (if needed).

Parameters
[in,out]daemondaemon to setup thread pool for
Returns
#MHD_SC_OK on success

Definition at line 619 of file daemon_start.c.