about summary refs log tree commit diff
path: root/listen.c
diff options
context:
space:
mode:
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);