Thu, 17 Dec 2015 14:25:33 +0000
client.lua: Handle unexpected disconnects in the middle of a test
scansion/objects/client.lua | file | annotate | diff | comparison | revisions |
--- a/scansion/objects/client.lua Thu Dec 17 14:25:09 2015 +0000 +++ b/scansion/objects/client.lua Thu Dec 17 14:25:33 2015 +0000 @@ -49,6 +49,11 @@ client.stream:hook("outgoing-raw", function (s) client.log("Data out: %s", s); end, 1000); -- And incoming, parsed, stanzas client.stream:hook("stanza", function (s) client.log("Stanza: %s", s) end); + -- Handle unexpected disconnects + client.stream:hook("disconnected", function (s) + client.log("Unexpected disconnect!"); + error("Unexpected disconnect"); + end); end; connects = function (client)