net/xmppclient_listener.lua

changeset 2454
e4818c49192d
parent 2170
2abca9cc78b1
child 2466
0e44b6035210
equal deleted inserted replaced
2453:44d4c69155e0 2454:e4818c49192d
24 local sessionmanager = require "core.sessionmanager"; 24 local sessionmanager = require "core.sessionmanager";
25 local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session; 25 local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session;
26 local sm_streamopened = sessionmanager.streamopened; 26 local sm_streamopened = sessionmanager.streamopened;
27 local sm_streamclosed = sessionmanager.streamclosed; 27 local sm_streamclosed = sessionmanager.streamclosed;
28 local st = require "util.stanza"; 28 local st = require "util.stanza";
29
30 local config = require "core.configmanager";
31 local opt_keepalives = config.get("*", "core", "tcp_keepalives");
29 32
30 local stream_callbacks = { stream_tag = "http://etherx.jabber.org/streams\1stream", 33 local stream_callbacks = { stream_tag = "http://etherx.jabber.org/streams\1stream",
31 default_ns = "jabber:client", 34 default_ns = "jabber:client",
32 streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza }; 35 streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza };
33 36
119 -- Client is using legacy SSL (otherwise mod_tls sets this flag) 122 -- Client is using legacy SSL (otherwise mod_tls sets this flag)
120 if conn:ssl() then 123 if conn:ssl() then
121 session.secure = true; 124 session.secure = true;
122 end 125 end
123 126
127 if opt_keepalives ~= nil then
128 conn:setoption("keepalive", opt_keepalives);
129 end
130
124 session.reset_stream = session_reset_stream; 131 session.reset_stream = session_reset_stream;
125 session.close = session_close; 132 session.close = session_close;
126 133
127 session_reset_stream(session); -- Initialise, ready for use 134 session_reset_stream(session); -- Initialise, ready for use
128 135

mercurial