aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/core')
-rw-r--r--xmpp-vala/src/core/stanza_writer.vala3
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala6
2 files changed, 8 insertions, 1 deletions
diff --git a/xmpp-vala/src/core/stanza_writer.vala b/xmpp-vala/src/core/stanza_writer.vala
index 51f0061f..62fe022a 100644
--- a/xmpp-vala/src/core/stanza_writer.vala
+++ b/xmpp-vala/src/core/stanza_writer.vala
@@ -1,6 +1,8 @@
namespace Xmpp {
public class StanzaWriter {
+ public signal void cancel();
+
private OutputStream output;
private Queue<SourceFuncWrapper> queue = new Queue<SourceFuncWrapper>();
@@ -43,6 +45,7 @@ public class StanzaWriter {
try {
yield output.write_all_async(data, 0, null, null);
} catch (GLib.Error e) {
+ cancel();
throw new XmlError.IO(@"IOError in GLib: $(e.message)");
} finally {
SourceFuncWrapper? sfw = queue.pop_head();
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index 7e7588b1..ad4dae97 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -97,6 +97,8 @@ public class XmppStream {
this.stream = stream;
reader = new StanzaReader.for_stream(stream.input_stream);
writer = new StanzaWriter.for_stream(stream.output_stream);
+
+ writer.cancel.connect(reader.cancel);
require_setup();
}
@@ -123,7 +125,9 @@ public class XmppStream {
[Version (deprecated = true, deprecated_since = "0.1", replacement = "write_async")]
public void write(StanzaNode node) {
write_async.begin(node, (obj, res) => {
- write_async.end(res);
+ try {
+ write_async.end(res);
+ } catch (Error e) { }
});
}