Software /
code /
prosody
Diff
plugins/mod_tls.lua @ 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 |
parent | 5378:ec3accda44d3 |
child | 5978:d21ea6001bba |
child | 5987:bd90250ee1ee |
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()