Comparison

plugins/mod_bosh.lua @ 2077:e33658f6052c

Changed separator between attribute names and prefixes from '|' to '\1' (optimization and cleanup).
author Waqas Hussain <waqas20@gmail.com>
date Thu, 12 Nov 2009 13:42:44 +0500
parent 1869:7456bb2a3458
child 2084:ded03b7b040e
comparison
equal deleted inserted replaced
2076:de2ae849b0b3 2077:e33658f6052c
21 local st = require "util.stanza"; 21 local st = require "util.stanza";
22 local logger = require "util.logger"; 22 local logger = require "util.logger";
23 local log = logger.init("mod_bosh"); 23 local log = logger.init("mod_bosh");
24 24
25 local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a literal in session.send) 25 local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a literal in session.send)
26 local stream_callbacks = { stream_tag = "http://jabber.org/protocol/httpbind|body", default_ns = xmlns_bosh }; 26 local stream_callbacks = { stream_tag = "http://jabber.org/protocol/httpbind\1body", default_ns = xmlns_bosh };
27 27
28 local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1; 28 local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1;
29 local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60; 29 local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60;
30 local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5; 30 local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5;
31 local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2; 31 local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2;
68 return; 68 return;
69 end 69 end
70 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body)); 70 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body));
71 request.notopen = true; 71 request.notopen = true;
72 request.log = log; 72 request.log = log;
73 local parser = lxp.new(init_xmlhandlers(request, stream_callbacks), "|"); 73 local parser = lxp.new(init_xmlhandlers(request, stream_callbacks), "\1");
74 74
75 parser:parse(body); 75 parser:parse(body);
76 76
77 local session = sessions[request.sid]; 77 local session = sessions[request.sid];
78 if session then 78 if session then