mod_bosh: Fixes to the session creation response - add mandatory 'wait' attribute, remove optional 'maxpause' which we don't support, and reformat the code to prevent long lines and wacky indentation. Fixes #219.

Sat, 11 Dec 2010 00:19:15 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 11 Dec 2010 00:19:15 +0000
changeset 3847
9ffcf7df0c62
parent 3846
763df64fdd9d
child 3848
3933e007f829

mod_bosh: Fixes to the session creation response - add mandatory 'wait' attribute, remove optional 'maxpause' which we don't support, and reformat the code to prevent long lines and wacky indentation. Fixes #219.

plugins/mod_bosh.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_bosh.lua	Sat Dec 11 00:14:34 2010 +0000
+++ b/plugins/mod_bosh.lua	Sat Dec 11 00:19:15 2010 +0000
@@ -33,7 +33,6 @@
 local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60;
 local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5;
 local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2;
-local BOSH_DEFAULT_MAXPAUSE = tonumber(module:get_option("bosh_max_pause")) or 300;
 
 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure");
 
@@ -283,9 +282,17 @@
 		fire_event("stream-features", session, features);
 		--xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'
 		local response = st.stanza("body", { xmlns = xmlns_bosh,
-									inactivity = tostring(BOSH_DEFAULT_INACTIVITY), polling = tostring(BOSH_DEFAULT_POLLING), requests = tostring(BOSH_DEFAULT_REQUESTS), hold = tostring(session.bosh_hold), maxpause = "120",
-									sid = sid, authid = sid, ver  = '1.6', from = session.host, secure = 'true', ["xmpp:version"] = "1.0",
-									["xmlns:xmpp"] = "urn:xmpp:xbosh", ["xmlns:stream"] = "http://etherx.jabber.org/streams" }):add_child(features);
+			wait = attr.wait,
+			inactivity = tostring(BOSH_DEFAULT_INACTIVITY),
+			polling = tostring(BOSH_DEFAULT_POLLING),
+			requests = tostring(BOSH_DEFAULT_REQUESTS),
+			hold = tostring(session.bosh_hold),
+			sid = sid, authid = sid,
+			ver  = '1.6', from = session.host,
+			secure = 'true', ["xmpp:version"] = "1.0",
+			["xmlns:xmpp"] = "urn:xmpp:xbosh",
+			["xmlns:stream"] = "http://etherx.jabber.org/streams"
+		}):add_child(features);
 		request:send{ headers = default_headers, body = tostring(response) };
 		
 		request.sid = sid;

mercurial