From 863d66b16eb60c4b28b52af52d944bfd1dc1b21a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 19 Aug 2021 15:39:58 +0200 Subject: Improve logging on jingle file transfer failure --- xmpp-vala/src/module/xep/0166_jingle/session.vala | 1 + xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'xmpp-vala/src') diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala index 0b377d0f..a45fc6db 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/session.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala @@ -407,6 +407,7 @@ public class Xmpp.Xep.Jingle.Session : Object { public void terminate(string? reason_name, string? reason_text, string? local_reason) { if (state == State.ENDED) return; + debug("Jingle session %s terminated: %s; %s; %s", this.sid, reason_name ?? "-", reason_text ?? "-", local_reason ?? "-"); if (state == State.ACTIVE) { string reason_str; diff --git a/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala b/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala index 4581019f..7b213ca5 100644 --- a/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala +++ b/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala @@ -105,9 +105,11 @@ public class Module : Jingle.ContentType, XmppStreamModule { yield io_stream.input_stream.close_async(); yield io_stream.output_stream.splice_async(input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE|OutputStreamSpliceFlags.CLOSE_TARGET); yield connection.terminate(true); - } catch (Jingle.Error e) { - session.terminate(Jingle.ReasonElement.FAILED_TRANSPORT, e.message, e.message); - throw new Jingle.Error.GENERAL(@"couldn't create Jingle session: $(e.message)"); + } catch (Error e) { + if (session != null) { + session.terminate(Jingle.ReasonElement.FAILED_TRANSPORT, e.message, e.message); + } + throw new Jingle.Error.GENERAL("Couldn't send file via Jingle: %s", e.message); } } -- cgit v1.2.3-70-g09d2