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() {
|
HostList.prototype.toArray = function toArray() {
|
||||||
|
var keys = Object.keys(this.map);
|
||||||
var out = [];
|
var out = [];
|
||||||
var i, j, keys, key, bucket, entry;
|
var i, key, entry;
|
||||||
|
|
||||||
for (i = 0; i < this.fresh.length; i++) {
|
for (i = 0; i < keys.length; i++) {
|
||||||
bucket = this.fresh[i];
|
key = keys[i];
|
||||||
keys = bucket.keys();
|
entry = this.map[key];
|
||||||
for (j = 0; j < keys.length; j++) {
|
out.push(entry);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(out.length, this.size());
|
assert.equal(out.length, this.size());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user