# HG changeset patch # User Matthew Wild # Date 1546163016 0 # Node ID 14500a149b31128516d59a00f499133b0db1ddf9 # Parent 0e2150680a2597a1f78a0c417d4fb425baabeca9 client: Ignore timeout timer if we received a stanza diff -r 0e2150680a25 -r 14500a149b31 scansion/objects/client.lua --- a/scansion/objects/client.lua Sat Dec 29 02:52:55 2018 -0500 +++ b/scansion/objects/client.lua Sun Dec 30 09:43:36 2018 +0000 @@ -95,11 +95,13 @@ receives = function (client, data) local wait, done = async.waiter(); local expected_stanza = false; + local have_received_stanza = false; data = table.concat(data):gsub("\t", " "):gsub("^%s+", ""):gsub("%s+$", ""); if data ~= "nothing" then expected_stanza = fill_vars(client.script, assert(parse_xml(data))); end local function stanza_handler(received_stanza) + have_received_stanza = true; if not expected_stanza then error(new_error("unexpected-stanza", { text = "Received unexpected stanza"; @@ -129,6 +131,7 @@ end client.stream:hook("stanza", stanza_handler, 100); verse.add_task(client.stanza_timeout or default_stanza_timeout, function () + if have_received_stanza then return; end if expected_stanza then client.log("TIMEOUT waiting for %s", expected_stanza) local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" });