# HG changeset patch # User Matthew Wild # Date 1389525409 18000 # Node ID 872ff4851c9b6cd662aac4b1a056ac2a97c85ce5 # Parent 0d219631d47b55ca78a59edfd334174ca312c9d0 mod_tls: Log error when TLS initialization fails diff -r 0d219631d47b -r 872ff4851c9b plugins/mod_tls.lua --- 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()