Changeset

2454:e4818c49192d

xmppclient_listener: Allow the tcp_keepalives option in the config to control whether keepalives are used
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Jan 2010 15:17:08 +0000
parents 2453:44d4c69155e0
children 2455:0b3184f3c9e4
files net/xmppclient_listener.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;