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

fork
mscdex 11 years ago
parent d80b873a6e
commit dfae2cb8d0

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

Loading…
Cancel
Save