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 |