add Close method to memory address book, which cancels the gc process

This commit is contained in:
vyzo 2019-04-28 12:19:26 +03:00
parent e4cf50160f
commit c58ce1f56f

View File

@ -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()