mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-02-16 07:50:09 +08:00
add Close method to memory address book, which cancels the gc process
This commit is contained in:
parent
e4cf50160f
commit
c58ce1f56f
@ -75,6 +75,11 @@ func (mab *memoryAddrBook) background() {
|
||||
}
|
||||
}
|
||||
|
||||
func (mab *memoryAddrBook) Close() error {
|
||||
mab.cancel()
|
||||
return nil
|
||||
}
|
||||
|
||||
// gc garbage collects the in-memory address book. The caller *must* hold the addrmu lock.
|
||||
func (mab *memoryAddrBook) gc() {
|
||||
now := time.Now()
|
||||
|
Loading…
Reference in New Issue
Block a user