Software /
code /
prosody
Comparison
plugins/mod_bosh.lua @ 1664:6587b6c2678e
mod_bosh: Calculate rid difference just once
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 11 Aug 2009 20:15:54 +0100 |
parent | 1663:b30c4d0bbe84 |
child | 1665:2c72b725384e |
comparison
equal
deleted
inserted
replaced
1663:b30c4d0bbe84 | 1664:6587b6c2678e |
---|---|
206 return; | 206 return; |
207 end | 207 end |
208 | 208 |
209 if session.rid then | 209 if session.rid then |
210 local rid = tonumber(attr.rid); | 210 local rid = tonumber(attr.rid); |
211 if rid - session.rid > 1 then | 211 local diff = rid - session.rid; |
212 if diff > 1 then | |
212 session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid); | 213 session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid); |
213 elseif session.rid >= rid then | 214 elseif diff <= 0 then |
214 -- Repeated, ignore | 215 -- Repeated, ignore |
215 session.log("debug", "rid repeated (on request %s), ignoring: %d", request.id, session.rid); | 216 session.log("debug", "rid repeated (on request %s), ignoring: %d", request.id, session.rid); |
216 request.notopen = nil; | 217 request.notopen = nil; |
217 t_insert(session.requests, request); | 218 t_insert(session.requests, request); |
218 return; | 219 return; |
219 end | 220 end |
220 request.rid = rid; | |
221 session.rid = rid; | 221 session.rid = rid; |
222 end | 222 end |
223 | 223 |
224 if attr.type == "terminate" then | 224 if attr.type == "terminate" then |
225 -- Client wants to end this session | 225 -- Client wants to end this session |