# HG changeset patch # User Matthew Wild # Date 1263309428 0 # Node ID e4818c49192ddc3d84ce7616ee2e04794d385d01 # Parent 44d4c69155e09c89a94db0f9140fab598789ddb3 xmppclient_listener: Allow the tcp_keepalives option in the config to control whether keepalives are used diff -r 44d4c69155e0 -r e4818c49192d net/xmppclient_listener.lua --- a/net/xmppclient_listener.lua Tue Jan 12 15:16:22 2010 +0000 +++ b/net/xmppclient_listener.lua Tue Jan 12 15:17:08 2010 +0000 @@ -27,6 +27,9 @@ 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 @@ 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;