aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-09-27 21:08:07 +0200
committerfiaxh <git@lightrise.org>2024-09-29 16:57:31 +0200
commit64e4fb00374b149580478145137f59374f287391 (patch)
treeae64f85144dbc62fefa7531ec4493b5764886189
parent439c37539332781f976d4dc7dbdfa37f2b60a3bf (diff)
downloaddino-64e4fb00374b149580478145137f59374f287391.tar.gz
dino-64e4fb00374b149580478145137f59374f287391.zip
Handle TlsError when reading from stream (caused uncatched Exception)
-rw-r--r--xmpp-vala/src/core/stanza_reader.vala6
1 files changed, 5 insertions, 1 deletions
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;
}