net.http: destroy_request(): Remove update for new server API, pass request.handler...
[prosody.git] / net / xmppclient_listener.lua
index 223fa89b62a3da3894fa2c066f416e4eee5f349c..3a0c65beaa98dfcbdf0a2a902edbe1b83465fb16 100644 (file)
@@ -27,8 +27,10 @@ local sm_streamopened = sessionmanager.streamopened;
 local sm_streamclosed = sessionmanager.streamclosed;
 local st = require "util.stanza";
 
-local stream_callbacks = { stream_tag = "http://etherx.jabber.org/streams\1stream", 
-               default_ns = "jabber:client",
+local config = require "core.configmanager";
+local opt_keepalives = config.get("*", "core", "tcp_keepalives");
+
+local stream_callbacks = { default_ns = "jabber:client",
                streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza };
 
 function stream_callbacks.error(session, error, data)
@@ -68,9 +70,8 @@ local function session_reset_stream(session)
                return true;
 end
 
-
 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
-local default_stream_attr = { ["xmlns:stream"] = stream_callbacks.stream_tag:match("[^\1]*"), xmlns = stream_callbacks.default_ns, version = "1.0", id = "" };
+local default_stream_attr = { ["xmlns:stream"] = "http://etherx.jabber.org/streams", xmlns = stream_callbacks.default_ns, version = "1.0", id = "" };
 local function session_close(session, reason)
        local log = session.log or log;
        if session.conn then
@@ -121,6 +122,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;