aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-12 15:17:08 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-12 15:17:08 +0000
commitfcfaa6536e3833399fcac7379bb2f4dba7a68497 (patch)
treeec96e9032c255d6317dc5083e62c8ad423f193ae /net
parenta00a7f76bc8bbc8a0174bfda7b7962e981e984df (diff)
downloadprosody-fcfaa6536e3833399fcac7379bb2f4dba7a68497.tar.gz
prosody-fcfaa6536e3833399fcac7379bb2f4dba7a68497.zip
xmppclient_listener: Allow the tcp_keepalives option in the config to control whether keepalives are used
Diffstat (limited to 'net')
-rw-r--r--net/xmppclient_listener.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index 223fa89b..61622c6a 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -27,6 +27,9 @@ local sm_streamopened = sessionmanager.streamopened;
local sm_streamclosed = sessionmanager.streamclosed;
local st = require "util.stanza";
+local config = require "core.configmanager";
+local opt_keepalives = config.get("*", "core", "tcp_keepalives");
+
local stream_callbacks = { stream_tag = "http://etherx.jabber.org/streams\1stream",
default_ns = "jabber:client",
streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza };
@@ -121,6 +124,10 @@ function xmppclient.onincoming(conn, data)
session.secure = true;
end
+ if opt_keepalives ~= nil then
+ conn:setoption("keepalive", opt_keepalives);
+ end
+
session.reset_stream = session_reset_stream;
session.close = session_close;