aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-12-18 18:35:35 +0100
committerKim Alvefur <zash@zash.se>2013-12-18 18:35:35 +0100
commita3dab92bb38f3c5b014cd94d646d74395424cfe3 (patch)
treeefc6f23000287c2b4ede53cf1e5339d409aaab9b /plugins
parent72d77534417279b36f2bfff101cb274ad3ba5864 (diff)
downloadprosody-a3dab92bb38f3c5b014cd94d646d74395424cfe3.tar.gz
prosody-a3dab92bb38f3c5b014cd94d646d74395424cfe3.zip
mod_component: Enable TCP keepalives on component streams
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_component.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index b6e111d5..c5a1da81 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -25,6 +25,8 @@ local hosts = prosody.hosts;
local log = module._log;
+local opt_keepalives = module:get_option_boolean("component_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true));
+
local sessions = module:shared("sessions");
function module.add_host(module)
@@ -269,6 +271,10 @@ function listener.onconnect(conn)
local conn_name = "jcp"..tostring(session):match("[a-f0-9]+$");
session.log = logger.init(conn_name);
session.close = session_close;
+
+ if opt_keepalives then
+ conn:setoption("keepalive", opt_keepalives);
+ end
session.log("info", "Incoming Jabber component connection");