aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-14 01:31:26 +0200
committerKim Alvefur <zash@zash.se>2018-09-14 01:31:26 +0200
commit68d9b01091eeba0df8283f06557be00c2c1f3001 (patch)
treee63a286e64b76c611757a6ae82478275583251ed /net
parent9291209e822354ad532160e6c66c58aeb1a3db5a (diff)
downloadprosody-68d9b01091eeba0df8283f06557be00c2c1f3001.tar.gz
prosody-68d9b01091eeba0df8283f06557be00c2c1f3001.zip
net.server_epoll: Catch errors from luasec.wrap
It throws if given an invalid TLS context
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index a9440258..ad888ef4 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -463,7 +463,11 @@ function interface:tlshandskake()
self._tls = true;
log("debug", "Start TLS on %s now", self);
self:del();
- local conn, err = luasec.wrap(self.conn, self.tls_ctx);
+ local ok, conn, err = pcall(luasec.wrap, self.conn, self.tls_ctx);
+ if not ok then
+ log("error", "Failed to initialize TLS: %s", conn);
+ conn, err = ok, conn;
+ end
if not conn then
self:on("disconnect", err);
self:destroy();