Changeset

5953:1c08d6cca552

mod_component: Enable TCP keepalives on component streams
author Kim Alvefur <zash@zash.se>
date Wed, 18 Dec 2013 18:35:35 +0100
parents 5952:31b800964dfb
children 5954:6dc73be95213 5974:9ce0d246c851
files plugins/mod_component.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_component.lua	Wed Dec 18 18:34:22 2013 +0100
+++ b/plugins/mod_component.lua	Wed Dec 18 18:35:35 2013 +0100
@@ -25,6 +25,8 @@
 
 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 @@
 	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");