aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 17:07:14 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 17:07:14 +0200
commite72b357bd7d697cfafa923b53daa226fdca91ae0 (patch)
tree25a707d29f86fe1964aa8271c978dd901fdadc1b /net
parent9f8d0b3e950e0365a75e708c7f7f5cb474183ecf (diff)
downloadprosody-e72b357bd7d697cfafa923b53daa226fdca91ae0.tar.gz
prosody-e72b357bd7d697cfafa923b53daa226fdca91ae0.zip
net.server_epoll: TLS handshake timeout
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 15c39ae8..2374ab57 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -30,6 +30,7 @@ local cfg = {
tcp_backlog = 128;
accept_retry_interval = 10;
read_retry_delay = 1e-06;
+ handshake_timeout = 60;
};
local fds = createtable(10, 0); -- FD -> conn
@@ -385,10 +386,13 @@ function interface:starttls(ctx)
self.onwriteable = interface.tlshandskake;
self.onreadable = interface.tlshandskake;
self:setflags(true, true);
+ self:setwritetimeout(cfg.handshake_timeout);
end
end
function interface:tlshandskake()
+ self:setwritetimeout(false);
+ self:setreadtimeout(false);
local ok, err = self.conn:dohandshake();
if ok then
log("debug", "TLS handshake on %s complete", tostring(self));
@@ -406,12 +410,10 @@ function interface:tlshandskake()
elseif err == "wantread" then
log("debug", "TLS handshake on %s to wait until readable", tostring(self));
self:setflags(true, false);
- self:setwritetimeout(false);
self:setreadtimeout(cfg.handshake_timeout);
elseif err == "wantwrite" then
log("debug", "TLS handshake on %s to wait until writable", tostring(self));
self:setflags(false, true);
- self:setreadtimeout(false);
self:setwritetimeout(cfg.handshake_timeout);
else
log("debug", "TLS handshake error on %s: %s", tostring(self), err);