scansion/objects/client.lua

changeset 172
2c17151ed21b
parent 171
433a1f36d0d3
child 173
14ed4cb241f4
--- a/scansion/objects/client.lua	Thu Mar 23 11:51:31 2023 +0000
+++ b/scansion/objects/client.lua	Thu Mar 23 12:14:53 2023 +0000
@@ -107,7 +107,12 @@
 		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
+			done();
+		end);
+		client.stream.conn:resume();
+		wait();
+
+		if not have_received_stanza then
 			if expected_stanza then
 				client.log("TIMEOUT waiting for %s", expected_stanza)
 				local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" });
@@ -117,9 +122,7 @@
 				client.log("Good - no stanzas were received (expected)");
 				done();
 			end
-		end);
-		client.stream.conn:resume();
-		wait();
+		end
 	end;
 
 	disconnects = function (client)

mercurial