mod_smacks/mod_smacks.lua
changeset 258 36648205b10a
parent 257 08fa42e1ab06
child 263 41f1cac40560
equal deleted inserted replaced
257:08fa42e1ab06 258:36648205b10a
    80 
    80 
    81 module:hook_stanza(xmlns_sm, "a", function (origin, stanza)
    81 module:hook_stanza(xmlns_sm, "a", function (origin, stanza)
    82 	if not origin.smacks then return; end
    82 	if not origin.smacks then return; end
    83 	origin.awaiting_ack = nil;
    83 	origin.awaiting_ack = nil;
    84 	-- Remove handled stanzas from outgoing_stanza_queue
    84 	-- Remove handled stanzas from outgoing_stanza_queue
       
    85 	--log("debug", "ACK: h=%s, last=%s", stanza.attr.h or "", origin.last_acknowledged_stanza or "");
    85 	local handled_stanza_count = tonumber(stanza.attr.h)-origin.last_acknowledged_stanza;
    86 	local handled_stanza_count = tonumber(stanza.attr.h)-origin.last_acknowledged_stanza;
    86 	local queue = origin.outgoing_stanza_queue;
    87 	local queue = origin.outgoing_stanza_queue;
    87 	if handled_stanza_count > #queue then
    88 	if handled_stanza_count > #queue then
    88 		module:log("warn", "The client says it handled %d new stanzas, but we only sent %d :)",
    89 		module:log("warn", "The client says it handled %d new stanzas, but we only sent %d :)",
    89 			handled_stanza_count, #queue);
    90 			handled_stanza_count, #queue);
   140 					sessionmanager.destroy_session(session); -- Re-destroy
   141 					sessionmanager.destroy_session(session); -- Re-destroy
   141 				end
   142 				end
   142 			end);
   143 			end);
   143 			return; -- Postpone destruction for now
   144 			return; -- Postpone destruction for now
   144 		end
   145 		end
       
   146 		
   145 	end
   147 	end
   146 	return _destroy_session(session, err);
   148 	return _destroy_session(session, err);
   147 end
   149 end