# HG changeset patch # User Kim Alvefur # Date 1360461241 -3600 # Node ID dbb3362c1ff3dc53c4071d273a4e9114468a7aeb # Parent 5bf3b13edb8076c16621a5e3ecad9f621f7147fa plugins.smacks: Don't try to reconnect on gracefull stream closure diff -r 5bf3b13edb80 -r dbb3362c1ff3 plugins/smacks.lua --- a/plugins/smacks.lua Sun Feb 10 02:53:03 2013 +0100 +++ b/plugins/smacks.lua Sun Feb 10 02:54:01 2013 +0100 @@ -44,6 +44,12 @@ return true; end end + + -- Graceful shutdown + local function on_close() + stream.resumption_token = nil; + stream:unhook("disconnected", on_disconnect); + end local function handle_sm_command(stanza) if stanza.name == "r" then -- Request for acks for stanzas we received @@ -67,9 +73,10 @@ -- Catch stanzas stream:hook("stanza", incoming_stanza); stream:hook("outgoing", outgoing_stanza); - + if stanza.attr.id then stream.resumption_token = stanza.attr.id; + stream:hook("closed", on_close, 100); stream:hook("disconnected", on_disconnect, 100); end elseif stanza.name == "resumed" then