pool: fix hostlist.toArray.
This commit is contained in:
parent
1a4984d533
commit
35fba9f3ae
@ -2778,23 +2778,14 @@ HostList.prototype.evictUsed = function evictUsed(bucket) {
|
||||
*/
|
||||
|
||||
HostList.prototype.toArray = function toArray() {
|
||||
var keys = Object.keys(this.map);
|
||||
var out = [];
|
||||
var i, j, keys, key, bucket, entry;
|
||||
var i, key, entry;
|
||||
|
||||
for (i = 0; i < this.fresh.length; i++) {
|
||||
bucket = this.fresh[i];
|
||||
keys = bucket.keys();
|
||||
for (j = 0; j < keys.length; j++) {
|
||||
key = keys[j];
|
||||
entry = bucket.get(key);
|
||||
out.push(entry.addr);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < this.used.length; i++) {
|
||||
bucket = this.used[i];
|
||||
for (entry = bucket.head; entry; entry = entry.next)
|
||||
out.push(entry.addr);
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
key = keys[i];
|
||||
entry = this.map[key];
|
||||
out.push(entry);
|
||||
}
|
||||
|
||||
assert.equal(out.length, this.size());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user