GNU libmicrohttpd 0.9.77
Loading...
Searching...
No Matches
daemon_run.c
Go to the documentation of this file.
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
25#include "internal.h"
26#include "connection_cleanup.h"
27#include "daemon_epoll.h"
28#include "daemon_poll.h"
29#include "daemon_select.h"
30
31
50enum MHD_StatusCode
51MHD_daemon_run (struct MHD_Daemon *daemon)
52{
53 enum MHD_StatusCode sc;
54
55 if (daemon->shutdown)
56 return MHD_SC_DAEMON_ALREADY_SHUTDOWN;
57 if (MHD_TM_EXTERNAL_EVENT_LOOP != daemon->threading_mode)
58 return MHD_SC_CONFIGURATION_MISMATCH_FOR_RUN_EXTERNAL;
59 switch (daemon->event_loop_syscall)
60 {
61 case MHD_ELS_POLL:
62 sc = MHD_daemon_poll_ (daemon,
63 MHD_NO);
65 return sc;
66#ifdef EPOLL_SUPPORT
67 case MHD_ELS_EPOLL:
68 sc = MHD_daemon_epoll_ (daemon,
69 MHD_NO);
71 return sc;
72#endif
73 case MHD_ELS_SELECT:
74 return MHD_daemon_select_ (daemon,
75 MHD_NO);
76 /* MHD_select does MHD_connection_cleanup_ already */
77 default:
78 return MHD_SC_CONFIGURATION_UNEXPECTED_ELS;
79 }
80}
81
82
83/* end of daemon_run.c */
void MHD_connection_cleanup_(struct MHD_Daemon *daemon)
functions to cleanup completed connection
non-public functions provided by daemon_epoll.c
enum MHD_StatusCode MHD_daemon_poll_(struct MHD_Daemon *daemon, bool may_block)
non-public functions provided by daemon_poll.c
enum MHD_StatusCode MHD_daemon_select_(struct MHD_Daemon *daemon, int may_block)
non-public functions provided by daemon_select.c
enum MHD_StatusCode MHD_daemon_run(struct MHD_Daemon *daemon)
Definition daemon_run.c:51
MHD internal shared structures.
@ MHD_NO
Definition microhttpd.h:162
enum MHD_EventLoopSyscall event_loop_syscall
Definition internal.h:1436
volatile bool shutdown
Definition internal.h:1526
enum MHD_ThreadingMode threading_mode
Definition internal.h:1417