Software /
code /
prosody
Changeset
11676:993462e5e4d4
net.server_epoll: Refactor immediate TLS handshake start
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 13 Jul 2021 14:55:21 +0200 |
parents | 11675:139d80774f11 |
children | 11677:98bcc19361db |
files | net/server_epoll.lua |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Tue Jul 13 14:51:05 2021 +0200 +++ b/net/server_epoll.lua Tue Jul 13 14:55:21 2021 +0200 @@ -570,7 +570,7 @@ end end -function interface:inittls(tls_ctx) +function interface:inittls(tls_ctx, now) if self._tls then return end if tls_ctx then self.tls_ctx = tls_ctx; end self._tls = true; @@ -612,6 +612,9 @@ self.ondrain = nil; self.onwritable = interface.tlshandshake; self.onreadable = interface.tlshandshake; + if now then + return self:tlshandshake() + end self:setreadtimeout(cfg.ssl_handshake_timeout); self:setwritetimeout(cfg.ssl_handshake_timeout); self:set(true, true); @@ -701,11 +704,7 @@ client:debug("New connection %s on server %s", client, self); if self.tls_direct then client:add(true, true); - if client:inittls(self.tls_ctx) then - client:setreadtimeout(cfg.ssl_handshake_timeout); - client:setwritetimeout(cfg.ssl_handshake_timeout); - client:tlshandshake(); - end + client:inittls(self.tls_ctx, true); else client:add(true, false); client:onconnect();