Don't delay processing of extra data until next tick

There could be other 'data' events that are waiting to be emitted before the end of the current tick.
fork
Brian White 12 years ago
parent a9062b98f3
commit ac71ac0c8f

@ -132,7 +132,7 @@ ImapConnection.prototype.connect = function(loginCb) {
state.conn.on('close', function(had_error) {
self._reset();
requests = state.requests;
self.debug&&self.debug('[connection] Connection forcefully closed.');
self.debug&&self.debug('[connection] Connection closed.');
self.emit('close', had_error);
});
@ -249,9 +249,6 @@ ImapConnection.prototype.connect = function(loginCb) {
}
}
if (b.p < b.length)
process.nextTick(function() { ondata(b); });
if (ondata.line[0] === '*') { // Untagged server response
var isUnsolicited =
(requests[0] && requests[0].cmd === 'NOOP')
@ -501,6 +498,8 @@ ImapConnection.prototype.connect = function(loginCb) {
ondata.temp = undefined;
ondata.streaming = false;
ondata.expect = -1;
if (b.p < b.length)
return ondata(b);
} else if (ondata.line[0] === 'A' || ondata.line[0] === '+') {
var line = ondata.line;
ondata.literals = [];

Loading…
Cancel
Save