Comparison

plugins/mod_bosh.lua @ 3450:4bd78a5fee75

mod_bosh: Fix to properly ignore repeated requests
author Matthew Wild <mwild1@gmail.com>
date Sat, 07 Aug 2010 19:00:04 +0100
parent 3449:0a74ce129a06
child 3460:742f6e5a4066
comparison
equal deleted inserted replaced
3449:0a74ce129a06 3450:4bd78a5fee75
286 session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid); 286 session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid);
287 elseif diff <= 0 then 287 elseif diff <= 0 then
288 -- Repeated, ignore 288 -- Repeated, ignore
289 session.log("debug", "rid repeated (on request %s), ignoring: %s (diff %d)", request.id, session.rid, diff); 289 session.log("debug", "rid repeated (on request %s), ignoring: %s (diff %d)", request.id, session.rid, diff);
290 request.notopen = nil; 290 request.notopen = nil;
291 request.ignore = true;
291 request.sid = sid; 292 request.sid = sid;
292 t_insert(session.requests, request); 293 t_insert(session.requests, request);
293 return; 294 return;
294 end 295 end
295 session.rid = rid; 296 session.rid = rid;
314 t_insert(session.requests, request); 315 t_insert(session.requests, request);
315 request.sid = sid; 316 request.sid = sid;
316 end 317 end
317 318
318 function stream_callbacks.handlestanza(request, stanza) 319 function stream_callbacks.handlestanza(request, stanza)
320 if request.ignore then return; end
319 log("debug", "BOSH stanza received: %s\n", stanza:top_tag()); 321 log("debug", "BOSH stanza received: %s\n", stanza:top_tag());
320 local session = sessions[request.sid]; 322 local session = sessions[request.sid];
321 if session then 323 if session then
322 if stanza.attr.xmlns == xmlns_bosh then 324 if stanza.attr.xmlns == xmlns_bosh then
323 stanza.attr.xmlns = nil; 325 stanza.attr.xmlns = nil;