Software /
code /
prosody
Changeset
9431:c3c0523a37c6
net.server_epoll: Catch errors from luasec.wrap
It throws if given an invalid TLS context
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 14 Sep 2018 01:31:26 +0200 |
parents | 9430:412ff404bf58 |
children | 9432:2e3f66475cc8 |
files | net/server_epoll.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Fri Sep 14 01:34:38 2018 +0200 +++ b/net/server_epoll.lua Fri Sep 14 01:31:26 2018 +0200 @@ -463,7 +463,11 @@ 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();