From 1bb75f40d26ad20381a200e09eaa9f519cffe398 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 22 Dec 2019 19:28:40 +0100 Subject: Add timing to logs, fix issue of silently ignored I/O errors --- xmpp-vala/src/core/xmpp_stream.vala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xmpp-vala/src/core/xmpp_stream.vala') diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala index 820d7ce8..97d00004 100644 --- a/xmpp-vala/src/core/xmpp_stream.vala +++ b/xmpp-vala/src/core/xmpp_stream.vala @@ -81,7 +81,7 @@ public class XmppStream { if (writer == null || reader == null || stream == null) { throw new IOStreamError.DISCONNECT("trying to disconnect, but no stream open"); } - log.str("OUT", ""); + log.str("OUT", "", this); yield writer.write(""); reader.cancel(); yield stream.close_async(); @@ -107,22 +107,25 @@ public class XmppStream { if (reader == null) throw new IOStreamError.READ("trying to read, but no stream open"); try { StanzaNode node = yield ((!)reader).read_node(); - log.node("IN", node); + log.node("IN", node, this); return node; } catch (XmlError e) { throw new IOStreamError.READ(e.message); } } + [Version (deprecated = true, deprecated_since = "0.1", replacement = "write_async")] public void write(StanzaNode node) { - write_async.begin(node); + write_async.begin(node, (obj, res) => { + write_async.end(res); + }); } public async void write_async(StanzaNode node) throws IOStreamError { StanzaWriter? writer = this.writer; if (writer == null) throw new IOStreamError.WRITE("trying to write, but no stream open"); try { - log.node("OUT", node); + log.node("OUT", node, this); yield ((!)writer).write_node(node); } catch (XmlError e) { throw new IOStreamError.WRITE(e.message); @@ -201,7 +204,7 @@ public class XmppStream { .put_attribute("xmlns", "jabber:client") .put_attribute("stream", "http://etherx.jabber.org/streams", XMLNS_URI); outs.has_nodes = true; - log.node("OUT ROOT", outs); + log.node("OUT ROOT", outs, this); write(outs); received_root_node(this, yield read_root()); } @@ -293,7 +296,7 @@ public class XmppStream { if (reader == null) throw new IOStreamError.READ("trying to read, but no stream open"); try { StanzaNode node = yield ((!)reader).read_root_node(); - log.node("IN ROOT", node); + log.node("IN ROOT", node, this); return node; } catch (XmlError.TLS e) { throw new IOStreamError.TLS(e.message); -- cgit v1.2.3-54-g00ecf