projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prosodyctl: Make the 'restart' command start Prosody even if it wasn't already running
[prosody.git]
/
plugins
/
mod_bosh.lua
diff --git
a/plugins/mod_bosh.lua
b/plugins/mod_bosh.lua
index 9546e653ddd021b2545b7248f81cbd51d142de46..d346f247c428020d8fbeef02b9b9415c40036780 100644
(file)
--- a/
plugins/mod_bosh.lua
+++ b/
plugins/mod_bosh.lua
@@
-10,8
+10,7
@@
module.host = "*" -- Global module
local hosts = _G.hosts;
local lxp = require "lxp";
local hosts = _G.hosts;
local lxp = require "lxp";
-local init_xmlhandlers = require "core.xmlhandlers"
-local server = require "net.server";
+local new_xmpp_stream = require "util.xmppstream".new;
local httpserver = require "net.httpserver";
local sm = require "core.sessionmanager";
local sm_destroy_session = sm.destroy_session;
local httpserver = require "net.httpserver";
local sm = require "core.sessionmanager";
local sm_destroy_session = sm.destroy_session;
@@
-21,6
+20,7
@@
local core_process_stanza = core_process_stanza;
local st = require "util.stanza";
local logger = require "util.logger";
local log = logger.init("mod_bosh");
local st = require "util.stanza";
local logger = require "util.logger";
local log = logger.init("mod_bosh");
+local timer = require "util.timer";
local xmlns_streams = "http://etherx.jabber.org/streams";
local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
local xmlns_streams = "http://etherx.jabber.org/streams";
local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
@@
-119,9
+119,10
@@
function handle_request(method, body, request)
request.log = log;
request.on_destroy = on_destroy_request;
request.log = log;
request.on_destroy = on_destroy_request;
- local parser = lxp.new(init_xmlhandlers(request, stream_callbacks), "\1");
-
- parser:parse(body);
+ local stream = new_xmpp_stream(request, stream_callbacks);
+ -- stream:feed() calls the stream_callbacks, so all stanzas in
+ -- the body are processed in this next line before it returns.
+ stream:feed(body);
local session = sessions[request.sid];
if session then
local session = sessions[request.sid];
if session then
@@
-401,13
+402,14
@@
function on_timer()
dead_sessions[i] = nil;
sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds");
end
dead_sessions[i] = nil;
sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds");
end
+ return 1;
end
local function setup()
local ports = module:get_option("bosh_ports") or { 5280 };
httpserver.new_from_config(ports, handle_request, { base = "http-bind" });
end
local function setup()
local ports = module:get_option("bosh_ports") or { 5280 };
httpserver.new_from_config(ports, handle_request, { base = "http-bind" });
-
server.addtimer(
on_timer);
+
timer.add_task(1,
on_timer);
end
if prosody.start_time then -- already started
setup();
end
if prosody.start_time then -- already started
setup();