Merge pull request #268 from celalo/patch-1

change state to disconnected when connection ends/closed
fork
Brian White 11 years ago
commit 332dfc7435

@ -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');
});

Loading…
Cancel
Save