aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-05-17 11:46:54 +0100
committerMatthew Wild <mwild1@gmail.com>2010-05-17 11:46:54 +0100
commit2eb914de98a14c237f09e69b21d63d7f636f3def (patch)
tree8e9133f19ea367cb6c4835b50db296095239add8
parent91492c1a60ae52094dc4ee49b440ea5decefbad1 (diff)
downloadprosody-2eb914de98a14c237f09e69b21d63d7f636f3def.tar.gz
prosody-2eb914de98a14c237f09e69b21d63d7f636f3def.zip
mod_bosh: Fix handling of rids by not dropping requests with repeated rids (assign them their sid instead), and always starting a session with first_rid-1.
-rw-r--r--plugins/mod_bosh.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 56e62680..ecce93cd 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -145,7 +145,7 @@ function stream_callbacks.streamopened(request, attr)
-- New session
sid = new_uuid();
- local session = { type = "c2s_unauthed", conn = {}, sid = sid, rid = tonumber(attr.rid), host = attr.to, bosh_version = attr.ver, bosh_wait = attr.wait, streamid = sid,
+ local session = { type = "c2s_unauthed", conn = {}, sid = sid, rid = tonumber(attr.rid)-1, host = attr.to, bosh_version = attr.ver, bosh_wait = attr.wait, streamid = sid,
bosh_hold = BOSH_DEFAULT_HOLD, bosh_max_inactive = BOSH_DEFAULT_INACTIVITY,
requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream, close = bosh_close_stream,
dispatch_stanza = core_process_stanza, log = logger.init("bosh"..sid), secure = request.secure };
@@ -212,8 +212,9 @@ function stream_callbacks.streamopened(request, attr)
session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid);
elseif diff <= 0 then
-- Repeated, ignore
- session.log("debug", "rid repeated (on request %s), ignoring: %d", request.id, session.rid);
+ session.log("debug", "rid repeated (on request %s), ignoring: %s (diff %d)", request.id, session.rid, diff);
request.notopen = nil;
+ request.sid = sid;
t_insert(session.requests, request);
return;
end