mod_cloud_notify/mod_cloud_notify.lua
changeset 4416 e5493a10c4d1
parent 4371 33f82988d7a9
child 4433 157fa4e535b0
equal deleted inserted replaced
4415:c3d21182ebf3 4416:e5493a10c4d1
   474 
   474 
   475 -- smacks hibernation is ended
   475 -- smacks hibernation is ended
   476 local function restore_session(event)
   476 local function restore_session(event)
   477 	local session = event.resumed;
   477 	local session = event.resumed;
   478 	if session then		-- older smacks module versions send only the "intermediate" session in event.session and no session.resumed one
   478 	if session then		-- older smacks module versions send only the "intermediate" session in event.session and no session.resumed one
   479 		if session.awaiting_push_timer then session.awaiting_push_timer:stop(); end
   479 		if session.awaiting_push_timer then
       
   480 			session.awaiting_push_timer:stop();
       
   481 			session.awaiting_push_timer = nil;
       
   482 		end
   480 		session.first_hibernated_push = nil;
   483 		session.first_hibernated_push = nil;
   481 	end
   484 	end
   482 end
   485 end
   483 
   486 
   484 -- smacks ack is delayed
   487 -- smacks ack is delayed
   485 local function ack_delayed(event)
   488 local function ack_delayed(event)
   486 	local session = event.origin;
   489 	local session = event.origin;
   487 	local queue = event.queue;
   490 	local queue = event.queue;
       
   491 	local stanza = event.stanza;
   488 	if not session.push_identifier then return; end
   492 	if not session.push_identifier then return; end
       
   493 	if stanza then process_stanza(session, stanza); return; end		-- don't iterate through smacks queue if we know which stanza triggered this
   489 	for i=1, #queue do
   494 	for i=1, #queue do
   490 		local stanza = queue[i];
   495 		local stanza = queue[i];
   491 		-- process unacked stanzas (handle_notify_request() will only send push requests for new stanzas)
   496 		-- process unacked stanzas (handle_notify_request() will only send push requests for new stanzas)
   492 		process_stanza(session, stanza);
   497 		process_stanza(session, stanza);
   493 	end
   498 	end