Connection.prototype._cleanupCalls = function (err) {
var count = 0;
var calls = this.calls;
this.calls = {}; // should reset calls before traverse it.
for (var id in calls) {
var call = calls[id];
call.setException(err);
count++;
}
// this.calls = {};
debug('conn#%d: clenaup %d calls, send "%s:%s" response.', this.id, count, err.name, err.message);
};
Created
April 27, 2013 09:18
-
-
Save fengmk2/5472462 to your computer and use it in GitHub Desktop.
遍历map之前先重置
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
setException会触发一个callback,然后callback里面的一些代码,又会触发_cleanupCalls,然后就杯具发生了。