From 64e4fb00374b149580478145137f59374f287391 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 27 Sep 2024 21:08:07 +0200 Subject: Handle TlsError when reading from stream (caused uncatched Exception) --- xmpp-vala/src/core/stanza_reader.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'xmpp-vala/src/core/stanza_reader.vala') diff --git a/xmpp-vala/src/core/stanza_reader.vala b/xmpp-vala/src/core/stanza_reader.vala index 349476ec..ff512497 100644 --- a/xmpp-vala/src/core/stanza_reader.vala +++ b/xmpp-vala/src/core/stanza_reader.vala @@ -36,7 +36,11 @@ public class StanzaReader { InputStream? input = this.input; if (input == null) throw new IOError.CLOSED("No input stream specified and end of buffer reached."); if (cancellable != null && cancellable.is_cancelled()) throw new IOError.CANCELLED("Input stream is canceled."); - buffer_fill = (int) yield ((!)input).read_async(buffer, GLib.Priority.DEFAULT, cancellable); + try { + buffer_fill = (int) yield ((!)input).read_async(buffer, GLib.Priority.DEFAULT, cancellable); + } catch (TlsError.EOF e) { + throw new IOError.CLOSED("End of TLS stream reached"); + } if (buffer_fill == 0) throw new IOError.CLOSED("End of input stream reached."); buffer_pos = 0; } -- cgit v1.2.3-70-g09d2