@@ -61,7 +61,7 @@ type pitCsTreeNode struct {
61
61
// NewPitCS creates a new combined PIT-CS for a forwarding thread.
62
62
func NewPitCS (onExpiration OnPitExpiration ) * PitCsTree {
63
63
pitCs := new (PitCsTree )
64
- pitCs .root = PitCsPools .PitCsTreeNode .Get ()
64
+ pitCs .root = PitCsPools .PitCsTreeNode .New ()
65
65
pitCs .root .component = enc.Component {} // zero component
66
66
pitCs .onExpiration = onExpiration
67
67
pitCs .pitTokens = make ([]* nameTreePitEntry , pitTokenLookupTableSize )
@@ -168,8 +168,11 @@ func (p *PitCsTree) RemoveInterest(pitEntry PitEntry) bool {
168
168
entry .node .pruneIfEmpty ()
169
169
p .nPitEntries --
170
170
171
- // leave the entry in the token table, but mark it as invalid
172
- // this stops it from being garbage collected and makes pool effective
171
+ // remove entry from pit token lookup table
172
+ tokIdx := p .pitTokenIdx (entry .Token ())
173
+ if p .pitTokens [tokIdx ] == entry {
174
+ p .pitTokens [tokIdx ] = nil
175
+ }
173
176
174
177
// now it is invalid to use the entry
175
178
entry .encname = nil // invalidate
@@ -307,8 +310,8 @@ func (p *pitCsTreeNode) getChildrenCount() int {
307
310
func (p * pitCsTreeNode ) pruneIfEmpty () {
308
311
for curNode := p ; curNode .parent != nil && curNode .getChildrenCount () == 0 &&
309
312
len (curNode .pitEntries ) == 0 && curNode .csEntry == nil ; curNode = curNode .parent {
310
- PitCsPools .PitCsTreeNode .Put (curNode )
311
313
delete (curNode .parent .children , curNode .component .Hash ())
314
+ PitCsPools .PitCsTreeNode .Put (curNode )
312
315
}
313
316
}
314
317
0 commit comments