Changeset

5976:872ff4851c9b 0.9.3

mod_tls: Log error when TLS initialization fails
author Matthew Wild <mwild1@gmail.com>
date Sun, 12 Jan 2014 06:16:49 -0500
parents 5975:0d219631d47b
children 5977:3f22f0de30f8
files plugins/mod_tls.lua
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_tls.lua	Sun Jan 05 22:21:50 2014 +0100
+++ b/plugins/mod_tls.lua	Sun Jan 12 06:16:49 2014 -0500
@@ -91,14 +91,21 @@
 	return true;
 end);
 
+local function assert_log(ret, err)
+	if not ret then
+		module:log("error", "Unable to initialize TLS: %s", err);
+	end
+	return ret;
+end
+
 function module.load()
 	local ssl_config = config.rawget(module.host, "ssl");
 	if not ssl_config then
 		local base_host = module.host:match("%.(.*)");
 		ssl_config = config.get(base_host, "ssl");
 	end
-	host.ssl_ctx = create_context(host.host, "client", ssl_config); -- for outgoing connections
-	host.ssl_ctx_in = create_context(host.host, "server", ssl_config); -- for incoming connections
+	host.ssl_ctx = assert_log(create_context(host.host, "client", ssl_config)); -- for outgoing connections
+	host.ssl_ctx_in = assert_log(create_context(host.host, "server", ssl_config)); -- for incoming connections
 end
 
 function module.unload()