change state to disconnected when connection ends/closed

fork
Celal Baris Ozdemir 11 years ago
parent b1fc9f5f89
commit 976e21709c

@ -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