aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0166_jingle
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-04-29 15:56:22 +0200
committerfiaxh <git@lightrise.org>2021-05-01 21:51:24 +0200
commit7d2e64769067c1b47e0500f6456dd7e6f4eb435a (patch)
tree0405bd7728c57928bb3c202f684ae85bb7494ffc /xmpp-vala/src/module/xep/0166_jingle
parent0409f554268c0e8f24e23e471a94de4d3a035ff1 (diff)
downloaddino-7d2e64769067c1b47e0500f6456dd7e6f4eb435a.tar.gz
dino-7d2e64769067c1b47e0500f6456dd7e6f4eb435a.zip
Improve call wording, cleanup
Diffstat (limited to 'xmpp-vala/src/module/xep/0166_jingle')
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/component.vala12
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/content.vala4
2 files changed, 13 insertions, 3 deletions
diff --git a/xmpp-vala/src/module/xep/0166_jingle/component.vala b/xmpp-vala/src/module/xep/0166_jingle/component.vala
index 544bcd69..5d573522 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/component.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/component.vala
@@ -31,7 +31,11 @@ namespace Xmpp.Xep.Jingle {
protected Gee.Promise<IOStream> promise = new Gee.Promise<IOStream>();
private string? terminated = null;
- public async void init(IOStream stream) {
+ public async void set_stream(IOStream? stream) {
+ if (stream == null) {
+ promise.set_exception(new IOError.FAILED("Jingle connection failed"));
+ return;
+ }
assert(!this.stream.ready);
promise.set_value(stream);
if (terminated != null) {
@@ -39,11 +43,17 @@ namespace Xmpp.Xep.Jingle {
}
}
+ public void set_error(GLib.Error? e) {
+ promise.set_exception(e);
+ }
+
public override async void terminate(bool we_terminated, string? reason_name = null, string? reason_text = null) {
if (terminated == null) {
terminated = (reason_name ?? "") + " - " + (reason_text ?? "") + @"we terminated? $we_terminated";
if (stream.ready) {
yield stream.value.close_async();
+ } else {
+ promise.set_exception(new IOError.FAILED("Jingle connection failed"));
}
}
}
diff --git a/xmpp-vala/src/module/xep/0166_jingle/content.vala b/xmpp-vala/src/module/xep/0166_jingle/content.vala
index befe02f4..41310aeb 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/content.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/content.vala
@@ -36,7 +36,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
public HashMap<string, ContentEncryption> encryptions = new HashMap<string, ContentEncryption>();
- public Set<string> tried_transport_methods = new HashSet<string>();
+ private Set<string> tried_transport_methods = new HashSet<string>();
public Content.initiate_sent(string content_name, Senders senders,
@@ -109,7 +109,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
transport_params.dispose();
foreach (ComponentConnection connection in component_connections.values) {
- connection.terminate(we_terminated, reason_name, reason_text);
+ connection.terminate.begin(we_terminated, reason_name, reason_text);
}
}