plugins/mod_smacks.lua
changeset 12064 3099e03b10bd
parent 12063 70a55fbe447c
child 12065 31a7e0ac6928
equal deleted inserted replaced
12063:70a55fbe447c 12064:3099e03b10bd
   419 end);
   419 end);
   420 
   420 
   421 module:hook("pre-resource-unbind", function (event)
   421 module:hook("pre-resource-unbind", function (event)
   422 	local session = event.session;
   422 	local session = event.session;
   423 	if not session.smacks then return end
   423 	if not session.smacks then return end
   424 		if not session.resumption_token then
   424 	if not session.resumption_token then
   425 			local queue = session.outgoing_stanza_queue;
   425 		local queue = session.outgoing_stanza_queue;
   426 		if queue:count_unacked() > 0 then
   426 		if queue:count_unacked() > 0 then
   427 			session.log("debug", "Destroying session with %d unacked stanzas", queue:count_unacked());
   427 			session.log("debug", "Destroying session with %d unacked stanzas", queue:count_unacked());
   428 				handle_unacked_stanzas(session);
   428 			handle_unacked_stanzas(session);
   429 			end
   429 		end
   430 		return
   430 		return
   431 	end
   431 	end
   432 
   432 
   433 	session.hibernating = os_time();
   433 	session.hibernating = os_time();
   434 	session.hibernating_watchdog = watchdog.new(resume_timeout, function()
   434 	session.hibernating_watchdog = watchdog.new(resume_timeout, function()