aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0166_jingle
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-10-04 17:49:16 +0200
committerMarvin W <git@larma.de>2026-10-23 17:01:41 +0200
commit630b1368331ef0034b343bd2f00b116c8cd90391 (patch)
tree30afc5a4471d084d7f074fce24df9a8d945b5084 /xmpp-vala/src/module/xep/0166_jingle
parentec4ca2a4642552b8424e7703840cd37e371e9e00 (diff)
Fix some warnings
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.vala12
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala7
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/session.vala7
4 files changed, 31 insertions, 7 deletions
diff --git a/xmpp-vala/src/module/xep/0166_jingle/component.vala b/xmpp-vala/src/module/xep/0166_jingle/component.vala
index e30175d5..f08ffbce 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/component.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/component.vala
@@ -41,7 +41,11 @@ namespace Xmpp.Xep.Jingle {
assert(!this.stream.ready);
promise.set_value(stream);
if (terminated != null) {
- yield stream.close_async();
+ try {
+ yield stream.close_async();
+ } catch (IOError e) {
+ warning("Failed closing stream provided for terminated connection: %s", e.message);
+ }
}
}
@@ -53,7 +57,11 @@ namespace Xmpp.Xep.Jingle {
if (terminated == null) {
terminated = (reason_name ?? "") + " - " + (reason_text ?? "") + @"we terminated? $we_terminated";
if (stream.ready) {
- yield stream.value.close_async();
+ try {
+ yield stream.value.close_async();
+ } catch (IOError e) {
+ warning("Failed closing stream when terminating connection: %s", e.message);
+ }
} 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 f6af1b17..07cadc36 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/content.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/content.vala
@@ -67,7 +67,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
ContentType content_type, ContentParameters content_params,
Transport transport, TransportParameters? transport_params,
SecurityPrecondition? security_precondition, SecurityParameters? security_params,
- Jid local_full_jid, Jid peer_full_jid) throws Error {
+ Jid local_full_jid, Jid peer_full_jid) {
this.content_name = content_name;
this.senders = senders;
this.role = Role.RESPONDER;
@@ -142,7 +142,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
this.content_params.accept(stream, session, this);
}
- internal void handle_accept(XmppStream stream, ContentNode content_node) {
+ internal void handle_accept(XmppStream stream, ContentNode content_node) throws IqError {
this.transport_params.handle_transport_accept(content_node.transport);
this.transport_params.create_transport_connection(stream, this);
this.content_params.handle_accept(stream, this.session, this, content_node.description);
@@ -157,7 +157,13 @@ public class Xmpp.Xep.Jingle.Content : Object {
return;
}
tried_transport_methods.add(new_transport.ns_uri);
- transport_params = new_transport.create_transport_parameters(stream, transport_params.components, local_full_jid, peer_full_jid);
+ try {
+ transport_params = new_transport.create_transport_parameters(stream, transport_params.components, local_full_jid, peer_full_jid);
+ } catch (Error e) {
+ session.terminate(ReasonElement.FAILED_TRANSPORT, null, e.message);
+ // TODO should we only terminate this content or really the whole session?
+ return;
+ }
set_transport_params(transport_params);
session.send_transport_replace(this, transport_params);
state = State.REPLACING_TRANSPORT;
diff --git a/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala b/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
index 9f0acd27..f451f4c9 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
@@ -24,7 +24,12 @@ public class Xmpp.Xep.Jingle.Flag : XmppStreamFlag {
public async Session? get_session(string sid) {
if (promises.has_key(sid)) {
- return yield promises[sid].future.wait_async();
+ try {
+ return yield promises[sid].future.wait_async();
+ } catch (FutureError e) {
+ warning("Failed waiting for session: %s", e.message);
+ return null;
+ }
}
return sessions[sid];
}
diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala
index 22e8e978..aa8d6656 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/session.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala
@@ -222,7 +222,12 @@ public class Xmpp.Xep.Jingle.Session : Object {
.put_node(content.transport_params.to_transport_stanza_node("content-add")));
Iq.Stanza iq = new Iq.Stanza.set(content_add_node) { to=peer_full_jid };
- yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ try {
+ yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ } catch (IOError e) {
+ warning("Error adding content: %s", e.message);
+ // FIXME: Probably need to clean up some state
+ }
}
private void handle_content_accept(ContentNode content_node) throws IqError {