# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1493149836 -7200
# Node ID c8e3a0caa0a9385a3a0110459c79a09b63b8b7a3
# Parent  12440a0043abfe6cb7bdcb59a11b7b8755f5d758
mod_tls: Rebuild SSL context objects on configuration reload - #701

diff -r 12440a0043ab -r c8e3a0caa0a9 plugins/mod_tls.lua
--- a/plugins/mod_tls.lua	Tue Apr 25 21:48:24 2017 +0200
+++ b/plugins/mod_tls.lua	Tue Apr 25 21:50:36 2017 +0200
@@ -35,7 +35,8 @@
 
 local ssl_ctx_c2s, ssl_ctx_s2sout, ssl_ctx_s2sin;
 local ssl_cfg_c2s, ssl_cfg_s2sout, ssl_cfg_s2sin;
-do
+
+function module.load()
 	local NULL, err = {};
 	local modhost = module.host;
 	local parent = modhost:match("%.(.*)$");
@@ -61,6 +62,8 @@
 	if not ssl_ctx_s2sin then module:log("error", "Error creating contexts for s2sin: %s", err); end
 end
 
+module:hook_global("config-reloaded", module.load);
+
 local function can_do_tls(session)
 	if not session.conn.starttls then
 		if not session.secure then