lighttpd 1.4.x
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
534 B

#ifndef _NETWORK_H_
#define _NETWORK_H_
#include "first.h"
#include "base_decls.h"
struct server_socket; /* declaration */
void network_accept_tcp_nagle_disable(int fd);
int network_init(server *srv, int stdin_fd);
int network_close(server *srv);
int network_register_fdevents(server *srv);
void network_unregister_sock(server *srv, struct server_socket *srv_socket);
[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.
2 years ago
void network_socket_activation_to_env (server *srv);