Software /
code /
prosody
Comparison
plugins/mod_bosh.lua @ 7656:296543556065
mod_bosh: Update BOSH wait timeout logic to work despite the addition of deferred requests
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 02 Sep 2016 23:25:11 +0100 |
parent | 7655:132819f409dc |
child | 7660:d2825ddaac19 |
comparison
equal
deleted
inserted
replaced
7655:132819f409dc | 7656:296543556065 |
---|---|
195 end | 195 end |
196 | 196 |
197 if not response.finished then | 197 if not response.finished then |
198 -- We're keeping this request open, to respond later | 198 -- We're keeping this request open, to respond later |
199 log("debug", "Have nothing to say, so leaving request unanswered for now"); | 199 log("debug", "Have nothing to say, so leaving request unanswered for now"); |
200 if session.bosh_wait then | |
201 session.bosh_wait_timer = module:add_timer(session.bosh_wait, after_bosh_wait, request, session) | |
202 end | |
203 end | 200 end |
204 | 201 |
205 if session.bosh_terminate then | 202 if session.bosh_terminate then |
206 session.log("debug", "Closing session with %d requests open", #session.requests); | 203 session.log("debug", "Closing session with %d requests open", #session.requests); |
207 session:close(); | 204 session:close(); |
208 return nil; | 205 return nil; |
209 else | 206 else |
207 if session.bosh_wait and #session.requests > 0 then | |
208 session.bosh_wait_timer = module:add_timer(session.bosh_wait, after_bosh_wait, session.requests[1], session) | |
209 end | |
210 | |
210 return true; -- Inform http server we shall reply later | 211 return true; -- Inform http server we shall reply later |
211 end | 212 end |
212 elseif response.finished then | 213 elseif response.finished then |
213 return; -- A response has been sent already | 214 return; -- A response has been sent already |
214 end | 215 end |