diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-13 17:28:50 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-13 17:28:50 +0200 |
commit | c3ba0cd3c5865294540fb559400941fa9c729eaa (patch) | |
tree | 0c01ce25d6be6a39f42e065c76480edacf448da7 /net/server_epoll.lua | |
parent | 1b350237418d21d46d3874d7f07e710753881e8e (diff) | |
download | prosody-c3ba0cd3c5865294540fb559400941fa9c729eaa.tar.gz prosody-c3ba0cd3c5865294540fb559400941fa9c729eaa.zip |
net.server_epoll: Factor Direct TLS handling out of connection initialization
Eventually it should be possible to create a socket that has a TLS
context but that does not automatically start TLS on connect.
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r-- | net/server_epoll.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 0c19b2a2..0de590ce 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -454,6 +454,7 @@ function interface:tlshandskake() self.onreadable = nil; self._tls = true; self:on("status", "ssl-handshake-complete"); + self.init = nil; -- Restore default method self:init(); elseif err == "wantread" then log("debug", "TLS handshake on %s to wait until readable", self); @@ -488,6 +489,9 @@ local function wrapsocket(client, server, pattern, listeners, tls_ctx) -- luasoc if client.getsockname then conn.sockname, conn.sockport = client:getsockname(); end + if tls_ctx then + conn.init = interface.starttls; + end return conn; end @@ -507,12 +511,8 @@ end -- Initialization function interface:init() - if self.tls_ctx and not self._tls then - return self:starttls(); - else - self:setwritetimeout(); - return self:setflags(true, true); - end + self:setwritetimeout(); + return self:setflags(true, true); end function interface:pause() |