diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-14 01:31:26 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-14 01:31:26 +0200 |
commit | 78c396508907ee753363de2a988fe717283c36c4 (patch) | |
tree | e63a286e64b76c611757a6ae82478275583251ed /net | |
parent | a13adc7a8c66f6096e2d2418acaa88c826b05d0e (diff) | |
download | prosody-78c396508907ee753363de2a988fe717283c36c4.tar.gz prosody-78c396508907ee753363de2a988fe717283c36c4.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.lua | 6 |
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(); |