aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0166_jingle/component.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/xep/0166_jingle/component.vala')
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/component.vala12
1 files changed, 11 insertions, 1 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"));
}
}
}