105 client.log("Calling done") |
105 client.log("Calling done") |
106 done(); |
106 done(); |
107 return true; |
107 return true; |
108 end |
108 end |
109 client.stream:hook("stanza", stanza_handler, 100); |
109 client.stream:hook("stanza", stanza_handler, 100); |
|
110 local finished_waiting; |
110 verse.add_task(client.stanza_timeout or default_stanza_timeout, function () |
111 verse.add_task(client.stanza_timeout or default_stanza_timeout, function () |
111 done(); |
112 if not finished_waiting then |
|
113 done(); |
|
114 end |
112 end); |
115 end); |
113 client.stream.conn:resume(); |
116 client.stream.conn:resume(); |
114 wait(); |
117 wait(); |
|
118 finished_waiting = true; |
115 |
119 |
116 if not have_received_stanza then |
120 if not have_received_stanza then |
117 if expected_stanza then |
121 if expected_stanza then |
118 client.log("TIMEOUT waiting for %s", expected_stanza) |
122 client.log("TIMEOUT waiting for %s", expected_stanza) |
119 local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" }); |
123 local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" }); |