about summary refs log tree commit diff
path: root/listen.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-27 00:44:14 -0400
committerJune McEnroe <june@causal.agency>2019-10-27 00:44:14 -0400
commit755de4c9500fa9fdafc5ac82ee16dd7a19013b9f (patch)
treefc2d702cc44fb4a2d872d0c7990bba7f8a3f1a42 /listen.c
parentDrop clients on zero-length reads (diff)
downloadpounce-755de4c9500fa9fdafc5ac82ee16dd7a19013b9f.tar.gz
pounce-755de4c9500fa9fdafc5ac82ee16dd7a19013b9f.zip
Reload certificate on SIGUSR1
Diffstat (limited to '')
-rw-r--r--listen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/listen.c b/listen.c
index d6e561f..952d798 100644
--- a/listen.c
+++ b/listen.c
@@ -27,8 +27,11 @@
 
 static struct tls *server;
 
-// TODO: Make this callable more than once to reload certificates?
 void listenConfig(const char *cert, const char *priv) {
+	tls_free(server);
+	server = tls_server();
+	if (!server) errx(EX_SOFTWARE, "tls_server");
+
 	struct tls_config *config = tls_config_new();
 	if (!config) errx(EX_SOFTWARE, "tls_config_new");
 
@@ -40,9 +43,6 @@ void listenConfig(const char *cert, const char *priv) {
 		);
 	}
 
-	server = tls_server();
-	if (!server) errx(EX_SOFTWARE, "tls_server");
-
 	error = tls_configure(server, config);
 	if (error) errx(EX_SOFTWARE, "tls_configure: %s", tls_error(server));
 	tls_config_free(config);