105 client.log("Calling done") |
105 client.log("Calling done") |
106 done(); |
106 done(); |
107 end |
107 end |
108 client.stream:hook("stanza", stanza_handler, 100); |
108 client.stream:hook("stanza", stanza_handler, 100); |
109 verse.add_task(client.stanza_timeout or default_stanza_timeout, function () |
109 verse.add_task(client.stanza_timeout or default_stanza_timeout, function () |
110 if have_received_stanza then return; end |
110 done(); |
|
111 end); |
|
112 client.stream.conn:resume(); |
|
113 wait(); |
|
114 |
|
115 if not have_received_stanza then |
111 if expected_stanza then |
116 if expected_stanza then |
112 client.log("TIMEOUT waiting for %s", expected_stanza) |
117 client.log("TIMEOUT waiting for %s", expected_stanza) |
113 local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" }); |
118 local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" }); |
114 error(e); |
119 error(e); |
115 end |
120 end |
116 if expected_stanza == false then |
121 if expected_stanza == false then |
117 client.log("Good - no stanzas were received (expected)"); |
122 client.log("Good - no stanzas were received (expected)"); |
118 done(); |
123 done(); |
119 end |
124 end |
120 end); |
125 end |
121 client.stream.conn:resume(); |
|
122 wait(); |
|
123 end; |
126 end; |
124 |
127 |
125 disconnects = function (client) |
128 disconnects = function (client) |
126 client.disconnect_expected = true; |
129 client.disconnect_expected = true; |
127 client.stream:close(); |
130 client.stream:close(); |