plugins/muc/subject.lib: If subject is not set by an occupant, it should come from...
[prosody.git] / plugins / mod_component.lua
index 3eaacb8eaf123994cea5237db7163c11b51cf5a4..1497b12fc6a0096661aae5e1345cab9f25c4be52 100644 (file)
@@ -25,6 +25,8 @@ local hosts = prosody.hosts;
 
 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)
@@ -86,7 +88,7 @@ function module.add_host(module)
 
                return true;
        end
-       module:hook("stanza/jabber:component:accept:handshake", handle_component_auth);
+       module:hook("stanza/jabber:component:accept:handshake", handle_component_auth, -1);
 
        -- Handle stanzas addressed to this component
        local function handle_stanza(event)
@@ -270,6 +272,10 @@ function listener.onconnect(conn)
        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");
 
        local stream = new_xmpp_stream(session, stream_callbacks);