From fcfaa6536e3833399fcac7379bb2f4dba7a68497 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 12 Jan 2010 15:17:08 +0000 Subject: xmppclient_listener: Allow the tcp_keepalives option in the config to control whether keepalives are used --- net/xmppclient_listener.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'net/xmppclient_listener.lua') 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; -- cgit v1.2.3