Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Only remove records during GC #135

Merged
merged 1 commit into from
Jul 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions pstoremem/addr_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@ func (mab *memoryAddrBook) SetAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Du
delete(amap, key)
}
}

// if we've expired all the signed addresses for a peer, remove their signed routing state record
if len(amap) == 0 {
delete(s.signedPeerRecords, p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should actually switch this to delete(s.addrs, p). Same below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien

Wont they be removed by GC ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there's no reason not to clean this up early if we know it's empty.

}
}

// UpdateAddrs updates the addresses associated with the given peer that have
Expand Down Expand Up @@ -330,11 +325,6 @@ func (mab *memoryAddrBook) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL t
}
}
}

// if we've expired all the signed addresses for a peer, remove their signed routing state record
if len(amap) == 0 {
delete(s.signedPeerRecords, p)
}
}

// Addrs returns all known (and valid) addresses for a given peer
Expand Down