From 976e21709ca491ccadb7677a403de6fc3b4ca2b2 Mon Sep 17 00:00:00 2001 From: Celal Baris Ozdemir Date: Sun, 21 Jul 2013 18:55:32 +0200 Subject: [PATCH] change state to disconnected when connection ends/closed --- lib/Connection.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Connection.js b/lib/Connection.js index 0596496..478b88d 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -114,6 +114,7 @@ Connection.prototype.connect = function() { socket.once('close', function(had_err) { clearTimeout(self._tmrConn); clearTimeout(self._tmrKeepalive); + self.state = 'disconnected'; self.debug && self.debug('[connection] Closed'); self.emit('close', had_err); }); @@ -121,6 +122,7 @@ Connection.prototype.connect = function() { socket.once('end', function() { clearTimeout(self._tmrConn); clearTimeout(self._tmrKeepalive); + self.state = 'disconnected'; self.debug && self.debug('[connection] Ended'); self.emit('end'); });