Skip to content

Commit

Permalink
fix: add updates from spdy-http2#48
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed Nov 2, 2018
1 parent eedec4d commit 95f648d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/spdy-transport/priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,7 @@ PriorityTree.prototype.addDefault = function addDefault (id) {

PriorityTree.prototype._removeNode = function _removeNode (node) {
delete this.map[node.id]
var index = utils.binarySearch(this.list, node, compareChildren)
this.list.splice(index, 1)
this.count--
}
8 changes: 8 additions & 0 deletions test/base/priority-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,12 @@ describe('Stream Priority tree', function () {

assert.strictEqual(tree.get(1).weight, 16)
})

it('Removing a node should remove it from the tree\'s list', function () {
tree.addDefault(1)

tree.get(1).remove()

assert.strictEqual(tree.list[0], undefined)
})
})

0 comments on commit 95f648d

Please sign in to comment.