From 1d39b657da5cd013394f340fd4f702dfc1a7365e Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Thu, 20 Oct 2016 09:38:53 +0000 Subject: [PATCH] Feature: Allow reloading TLS key on the fly --- src/cfgfile.c | 2 ++ src/connection.c | 6 ++++++ src/connection.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/cfgfile.c b/src/cfgfile.c index 4785e866..c51f338f 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -39,6 +39,7 @@ #include "yp.h" #include "fserve.h" #include "stats.h" +#include "connection.h" #define CATMODULE "CONFIG" #define CONFIG_DEFAULT_LOCATION "Earth" @@ -636,6 +637,7 @@ void config_reread_config(void) config_set_config(&new_config); config = config_get_config_unlocked(); restart_logging(config); + connection_reread_config(config); yp_recheck_config(config); fserve_recheck_mime_types(config); stats_global(config); diff --git a/src/connection.c b/src/connection.c index 74403305..fdcf3ce6 100644 --- a/src/connection.c +++ b/src/connection.c @@ -107,6 +107,7 @@ static matchfile_t *banned_ip, *allowed_ip; rwlock_t _source_shutdown_rwlock; static void _handle_connection(void); +static void get_ssl_certificate(ice_config_t *config); void connection_initialize(void) { @@ -142,6 +143,11 @@ void connection_shutdown(void) _initialized = 0; } +void connection_reread_config(struct ice_config_tag *config) +{ + get_ssl_certificate(config); +} + static unsigned long _next_connection_id(void) { unsigned long id; diff --git a/src/connection.h b/src/connection.h index 3e05c37e..5d9c2bfe 100644 --- a/src/connection.h +++ b/src/connection.h @@ -49,6 +49,7 @@ typedef struct connection_tag void connection_initialize(void); void connection_shutdown(void); +void connection_reread_config(struct ice_config_tag *config); void connection_accept_loop(void); int connection_setup_sockets(struct ice_config_tag *config); void connection_close(connection_t *con);