connection: add additional guards for idle changing

fork
Brian White 11 years ago
parent 37778d8747
commit 9ee0f51818

@ -205,7 +205,8 @@ Connection.prototype.connect = function() {
if (self._queue.length === 0
&& self._config.keepalive
&& self.state === 'authenticated') {
&& self.state === 'authenticated'
&& !self._idle.enabled) {
self._idle.enabled = true;
self._doKeepaliveTimer(true);
}
@ -1368,7 +1369,8 @@ Connection.prototype._resTagged = function(info) {
if (this._queue.length === 0
&& this._config.keepalive
&& this.state === 'authenticated') {
&& this.state === 'authenticated'
&& !this._idle.enabled) {
this._idle.enabled = true;
this._doKeepaliveTimer(true);
}
@ -1582,7 +1584,8 @@ Connection.prototype._enqueue = function(fullcmd, promote, cb) {
} else if (this._curReq
&& this._curReq.type === 'IDLE'
&& this._sock
&& this._sock.writable) {
&& this._sock.writable
&& this._idle.enabled) {
this._idle.enabled = false;
this.debug && this.debug('=> DONE');
this._sock.write('DONE' + CRLF);

Loading…
Cancel
Save