Connection: defer message 'attributes' and 'end' events until next tick

fork
mscdex 12 years ago
parent d80b873a6e
commit dfae2cb8d0

@ -1027,7 +1027,9 @@ Connection.prototype._resUntagged = function(info) {
if (i === 0) {
if (!msg.ended) {
msg.ended = true;
msgEmitter.emit('end');
process.nextTick(function() {
msgEmitter.emit('end');
});
}
return;
}
@ -1047,8 +1049,10 @@ Connection.prototype._resUntagged = function(info) {
}
if (toget.length === 0) {
msgEmitter.emit('attributes', attrs);
msgEmitter.emit('end');
process.nextTick(function() {
msgEmitter.emit('attributes', attrs);
msgEmitter.emit('end');
});
} else if (msg === undefined) {
this._curReq.fetchCache[info.num] = {
msgEmitter: msgEmitter,

Loading…
Cancel
Save