Software /
code /
prosody
Comparison
plugins/mod_bosh.lua @ 4308:50e1a3dc2b50
mod_bosh: Mark a session as active when a request comes in, even if we don't end up holding that request, fixes BOSH ghosts (thanks smoku)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 05 Jun 2011 11:48:57 +0100 |
parent | 4102:9df4e61c260b |
child | 4311:d6366294f618 |
comparison
equal
deleted
inserted
replaced
4305:e3ffa91517cc | 4308:50e1a3dc2b50 |
---|---|
123 -- the body are processed in this next line before it returns. | 123 -- the body are processed in this next line before it returns. |
124 stream:feed(body); | 124 stream:feed(body); |
125 | 125 |
126 local session = sessions[request.sid]; | 126 local session = sessions[request.sid]; |
127 if session then | 127 if session then |
128 -- Session was marked as inactive, since we have | 128 -- Session was marked as inactive, since we have |
129 -- a request open now, unmark it | 129 -- a request open now, unmark it |
130 if inactive_sessions[session] then | 130 if inactive_sessions[session] and #session.requests > 0 then |
131 inactive_sessions[session] = nil; | 131 inactive_sessions[session] = nil; |
132 end | 132 end |
133 | 133 |
134 local r = session.requests; | 134 local r = session.requests; |
135 log("debug", "Session %s has %d out of %d requests open", request.sid, #r, session.bosh_hold); | 135 log("debug", "Session %s has %d out of %d requests open", request.sid, #r, session.bosh_hold); |
136 log("debug", "and there are %d things in the send_buffer", #session.send_buffer); | 136 log("debug", "and there are %d things in the send_buffer", #session.send_buffer); |
137 if #r > session.bosh_hold then | 137 if #r > session.bosh_hold then |