summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-05-26 02:46:05 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2022-06-04 13:44:16 -0400
commitda8025fb3075397a2c3edea08cdc5b8c5a624896 (patch)
tree14befac8022455d134b4c0ddf3b45a47a2536738 /src/network.c
parent33f73b4d821a3cd09614533d592f102166963cc5 (diff)
downloadlighttpd-git-da8025fb3075397a2c3edea08cdc5b8c5a624896.tar.gz
[core] reset internal flags after graceful restart
reset internal socket flags after graceful restart: re-init srv->socket->sidx and srv_socket->is_ssl after SIGUSR1 or systemd socket activation (thx jens-maus) x-ref: https://github.com/jens-maus/RaspberryMatic/pull/1847
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network.c b/src/network.c
index 6fc6a840..4a2cd36d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -425,6 +425,10 @@ static int network_server_init(server *srv, network_socket_config *s, buffer *ho
/* check if we already know this socket (after potential DNS resolution), and if yes, don't init it */
for (uint32_t i = 0; i < srv->srv_sockets.used; ++i) {
if (0 == memcmp(&srv->srv_sockets.ptr[i]->addr, &addr, sizeof(addr))) {
+ if ((unsigned short)~0u == srv->srv_sockets.ptr[i]->sidx) {
+ srv->srv_sockets.ptr[i]->sidx = sidx;
+ srv->srv_sockets.ptr[i]->is_ssl = s->ssl_enabled;
+ }
return 0;
}
}
@@ -873,12 +877,21 @@ int network_init(server *srv, int stdin_fd) {
force_assert(NULL != srv_socket);
memcpy(srv_socket, srv->srv_sockets_inherited.ptr[i],
sizeof(server_socket));
+ srv_socket->is_ssl = p->defaults.ssl_enabled;
/*(note: re-inits srv_socket->srv_token to new buffer ptr)*/
network_srv_socket_init_token(srv_socket,srv_socket->srv_token);
network_srv_sockets_append(srv, srv_socket);
}
}
+ /* reset sidx of any graceful sockets not explicitly listed in config */
+ for (uint32_t i = 0; i < srv->srv_sockets.used; ++i) {
+ if ((unsigned short)~0u == srv->srv_sockets.ptr[i]->sidx) {
+ srv->srv_sockets.ptr[i]->sidx = 0;
+ srv->srv_sockets.ptr[i]->is_ssl = p->defaults.ssl_enabled;
+ }
+ }
+
} while (0);
free(p->cvlist);