aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-09-02 23:25:11 +0100
committerMatthew Wild <mwild1@gmail.com>2016-09-02 23:25:11 +0100
commit3d97ccf0b9dd7680196a7f61e3044ac779de6c75 (patch)
tree84d9fa03d3439f4564c62053ae05c94b37c520b0
parentf2ae066a6250ecd0dc0bcfdf31848879cf9e2b18 (diff)
downloadprosody-3d97ccf0b9dd7680196a7f61e3044ac779de6c75.tar.gz
prosody-3d97ccf0b9dd7680196a7f61e3044ac779de6c75.zip
mod_bosh: Update BOSH wait timeout logic to work despite the addition of deferred requests
-rw-r--r--plugins/mod_bosh.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 39d5a8be..1a5d3904 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -197,9 +197,6 @@ function handle_POST(event)
if not response.finished then
-- We're keeping this request open, to respond later
log("debug", "Have nothing to say, so leaving request unanswered for now");
- if session.bosh_wait then
- session.bosh_wait_timer = module:add_timer(session.bosh_wait, after_bosh_wait, request, session)
- end
end
if session.bosh_terminate then
@@ -207,6 +204,10 @@ function handle_POST(event)
session:close();
return nil;
else
+ if session.bosh_wait and #session.requests > 0 then
+ session.bosh_wait_timer = module:add_timer(session.bosh_wait, after_bosh_wait, session.requests[1], session)
+ end
+
return true; -- Inform http server we shall reply later
end
elseif response.finished then