Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 8746:df1ca586c68d
mod_bosh: Some additonal comments to improve code readability
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 10 Apr 2018 20:30:20 +0100 |
| parents | e098c9b25014 |
| children | f91d45a692f0 |
comparison
equal
deleted
inserted
replaced
| 8745:e098c9b25014 | 8746:df1ca586c68d |
|---|---|
| 367 local diff = rid - session.rid; | 367 local diff = rid - session.rid; |
| 368 -- Diff should be 1 for a healthy request | 368 -- Diff should be 1 for a healthy request |
| 369 if diff ~= 1 then | 369 if diff ~= 1 then |
| 370 context.sid = sid; | 370 context.sid = sid; |
| 371 context.notopen = nil; | 371 context.notopen = nil; |
| 372 if diff == 2 then | 372 if diff == 2 then -- Missed a request |
| 373 -- Hold request, but don't process it (ouch!) | 373 -- Hold request, but don't process it (ouch!) |
| 374 session.log("debug", "rid skipped: %d, deferring this request", rid-1) | 374 session.log("debug", "rid skipped: %d, deferring this request", rid-1) |
| 375 context.defer = true; | 375 context.defer = true; |
| 376 session.bosh_deferred = { context = context, sid = sid, rid = rid, terminate = attr.type == "terminate" }; | 376 session.bosh_deferred = { context = context, sid = sid, rid = rid, terminate = attr.type == "terminate" }; |
| 377 return; | 377 return; |
| 378 end | 378 end |
| 379 -- Set a marker to indicate that stanzas in this request should NOT be processed | |
| 380 -- (these stanzas will already be in the XML parser's buffer) | |
| 379 context.ignore = true; | 381 context.ignore = true; |
| 380 if diff == 0 then | 382 if diff == 0 then |
| 381 -- Re-send previous response, ignore stanzas in this request | 383 -- Re-send previous response, ignore stanzas in this request |
| 382 session.log("debug", "rid repeated, ignoring: %s (diff %d)", session.rid, diff); | 384 session.log("debug", "rid repeated, ignoring: %s (diff %d)", session.rid, diff); |
| 383 response:send(session.bosh_last_response); | 385 response:send(session.bosh_last_response); |
