aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-06-01 18:48:58 +0200
committerfiaxh <git@lightrise.org>2019-06-01 19:03:01 +0200
commit8120203d62f52315f04364e70b3ac6beefe043de (patch)
treec994364641429f50ae36b3e68bb5811326fcd488 /libdino/src
parent8aab18c1ec37fd427e2dcaa2ee37be8467d15d16 (diff)
downloaddino-8120203d62f52315f04364e70b3ac6beefe043de.tar.gz
dino-8120203d62f52315f04364e70b3ac6beefe043de.zip
Don't set timeouts on registration connection attempts
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/registration.vala25
1 files changed, 18 insertions, 7 deletions
diff --git a/libdino/src/service/registration.vala b/libdino/src/service/registration.vala
index 8cac355e..f2384f52 100644
--- a/libdino/src/service/registration.vala
+++ b/libdino/src/service/registration.vala
@@ -75,42 +75,53 @@ public class Register : StreamInteractionModule, Object{
Idle.add((owned)callback);
}
});
- Timeout.add_seconds(5, () => {
+
+ stream.connect.begin(jid.domainpart, (_, res) => {
+ try {
+ stream.connect.end(res);
+ } catch (Error e) {
+ debug("Error connecting to stream: %s", e.message);
+ }
if (callback != null) {
Idle.add((owned)callback);
}
- return false;
});
- stream.connect.begin(jid.domainpart);
yield;
+
try {
stream.disconnect();
} catch (Error e) {}
return ret;
}
- public static async Xep.InBandRegistration.Form get_registration_form(Jid jid) {
+ public static async Xep.InBandRegistration.Form? get_registration_form(Jid jid) {
XmppStream stream = new XmppStream();
stream.add_module(new Tls.Module());
stream.add_module(new Iq.Module());
stream.add_module(new Xep.SrvRecordsTls.Module());
stream.add_module(new Xep.InBandRegistration.Module());
- stream.connect.begin(jid.bare_jid.to_string());
Xep.InBandRegistration.Form? form = null;
SourceFunc callback = get_registration_form.callback;
+
stream.stream_negotiated.connect(() => {
if (callback != null) {
Idle.add((owned)callback);
}
});
- Timeout.add_seconds(5, () => {
+
+ stream.connect.begin(jid.domainpart, (_, res) => {
+ try {
+ stream.connect.end(res);
+ } catch (Error e) {
+ debug("Error connecting to stream: %s", e.message);
+ }
if (callback != null) {
Idle.add((owned)callback);
}
- return false;
});
+
yield;
if (stream.negotiation_complete) {
form = yield stream.get_module(Xep.InBandRegistration.Module.IDENTITY).get_from_server(stream, jid);