From dbc13a83b3832e4c07977e4761a58e28a00e22f0 Mon Sep 17 00:00:00 2001 From: semu Date: Tue, 26 Jun 2012 01:54:43 +0300 Subject: [PATCH 1/2] Update master --- lib/xmpp/connection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/xmpp/connection.js b/lib/xmpp/connection.js index 2e67fd106..7e8ee7ada 100644 --- a/lib/xmpp/connection.js +++ b/lib/xmpp/connection.js @@ -124,7 +124,9 @@ Connection.prototype.send = function(stanza) { if (stanza.root) { var el = this.rmXmlns(stanza.root()); this.socket.serializeStanza(el, function(s) { - flushed = self.socket.write(s); + if (self.socket.writable) { + flushed = self.socket.write(s); + } }); } else { flushed = this.socket.write(stanza); From c4eb1770d1a5fd84200b848dc892b0545a168a8e Mon Sep 17 00:00:00 2001 From: semu Date: Tue, 26 Jun 2012 01:58:43 +0300 Subject: [PATCH 2/2] Update master --- lib/xmpp/connection.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/xmpp/connection.js b/lib/xmpp/connection.js index 7e8ee7ada..61c70e9d5 100644 --- a/lib/xmpp/connection.js +++ b/lib/xmpp/connection.js @@ -124,9 +124,11 @@ Connection.prototype.send = function(stanza) { if (stanza.root) { var el = this.rmXmlns(stanza.root()); this.socket.serializeStanza(el, function(s) { - if (self.socket.writable) { - flushed = self.socket.write(s); - } + if (self.socket.writable) { + self.socket.write(s); + } else { + self.error('internal-server-error', 'socket not writable'); + } }); } else { flushed = this.socket.write(stanza);