2005-02-20 14:27:00 +00:00
|
|
|
#ifndef _NETWORK_H_
|
|
|
|
#define _NETWORK_H_
|
2016-03-19 15:14:35 +00:00
|
|
|
#include "first.h"
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2018-03-25 07:45:05 +00:00
|
|
|
#include "base_decls.h"
|
|
|
|
|
|
|
|
struct server_socket; /* declaration */
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2016-06-30 01:02:44 +00:00
|
|
|
void network_accept_tcp_nagle_disable(int fd);
|
|
|
|
|
2019-02-04 04:27:57 +00:00
|
|
|
__attribute_cold__
|
2017-10-08 00:16:09 +00:00
|
|
|
int network_init(server *srv, int stdin_fd);
|
2019-02-04 04:27:57 +00:00
|
|
|
|
|
|
|
__attribute_cold__
|
2005-02-20 14:27:00 +00:00
|
|
|
int network_close(server *srv);
|
|
|
|
|
2019-02-04 04:27:57 +00:00
|
|
|
__attribute_cold__
|
2005-02-20 14:27:00 +00:00
|
|
|
int network_register_fdevents(server *srv);
|
2019-02-04 04:27:57 +00:00
|
|
|
|
|
|
|
__attribute_cold__
|
2018-03-25 07:45:05 +00:00
|
|
|
void network_unregister_sock(server *srv, struct server_socket *srv_socket);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
[core] graceful and immediate restart option
graceful and (nearly) immediate lighttpd restart option
For *some* configurations, it *may* be safe to background the current
lighttpd server (or workers) to continue processing active requests
and, in parallel, to start up a new lighttpd server with a new
configuration. For other configurations, doing so might not be safe!
Therefore, this option must be explicitly configured to enable:
server.feature-flags += ("server.graceful-restart-bg" => "enable")
server.systemd-socket-activation = "enable"
Along with enabling server.feature-flags "server.graceful-restart-bg",
enabling server.systemd-socket-activation allows transfer of open
listening sockets to the new lighttpd server instance, and occurs
without closing the listening sockets and without destroying the
kernel listen backlog queue on the socket.
Safe configurations may include lighttpd.conf which connect to
standalone backend daemons, e.g. proxying to other servers,
including PHP-FPM backends.
Unsafe configurations include lighttpd.conf which use "bin-path" option
in *.server configs, instructing lighttpd to execute the backends.
Using the graceful-and-immediate-restart option is likely *unsafe* if
the backend daemon expects only one instance of itself to run at a time.
Current implementation of graceful and immediate restart option keeps
the backgrounded lighttpd in the same process group, so that subsequent
SIGINT or SIGTERM will shut down both the new and the backgrounded
servers. (An alternative option (commented out in the code) is to
background and detach from the new lighttpd process.) Regardless,
existing subprocesses, such as CGI, remain in original process group.
As a result, the new lighttpd server may receive SIGCHLD for unknown
processes inherited from the old server, which the new lighttpd server
will reap and discard. The original lighttpd server, now a child, will
be unable to detect exit or reap and report status on those pre-existing
subprocesses.
Graceful restart is triggered in lighttpd by sending lighttpd SIGUSR1.
If lighttpd is configured with workers, then SIGINT (not SIGUSR1) is
sent to the process group, including other processes started by
lighttpd, e.g. CGI. To work well with graceful restart, CGI scripts and
other processes should trap SIGINT (and SIGUSR1 for good measure).
Long-running scripts may want to checkpoint and close, e.g. a CGI script
implementing a long-running websocket connection.
2020-09-25 14:59:28 +00:00
|
|
|
__attribute_cold__
|
|
|
|
void network_socket_activation_to_env (server *srv);
|
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
#endif
|