mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-01-30 05:10:08 +08:00
remove noop Stop() in address book.
This commit is contained in:
parent
4b2c1212e7
commit
5b9ad98cc2
@ -80,11 +80,6 @@ func NewAddrBook(ctx context.Context, store ds.TxnDatastore, opts Options) (*dsA
|
||||
return mgr, nil
|
||||
}
|
||||
|
||||
// Stop will signal the TTL manager to stop and block until it returns.
|
||||
func (mgr *dsAddrBook) Stop() {
|
||||
// noop
|
||||
}
|
||||
|
||||
func keysAndAddrs(p peer.ID, addrs []ma.Multiaddr) ([]ds.Key, []ma.Multiaddr, error) {
|
||||
var (
|
||||
keys = make([]ds.Key, len(addrs))
|
||||
|
@ -172,9 +172,9 @@ func badgerStore(t testing.TB) (ds.TxnDatastore, func()) {
|
||||
|
||||
func peerstoreFactory(tb testing.TB, opts Options) pt.PeerstoreFactory {
|
||||
return func() (pstore.Peerstore, func()) {
|
||||
ds, closeFunc := badgerStore(tb)
|
||||
store, closeFunc := badgerStore(tb)
|
||||
|
||||
ps, err := NewPeerstore(context.Background(), ds, opts)
|
||||
ps, err := NewPeerstore(context.Background(), store, opts)
|
||||
if err != nil {
|
||||
tb.Fatal(err)
|
||||
}
|
||||
@ -185,17 +185,13 @@ func peerstoreFactory(tb testing.TB, opts Options) pt.PeerstoreFactory {
|
||||
|
||||
func addressBookFactory(tb testing.TB, opts Options) pt.AddrBookFactory {
|
||||
return func() (pstore.AddrBook, func()) {
|
||||
ds, closeDB := badgerStore(tb)
|
||||
store, closeFunc := badgerStore(tb)
|
||||
|
||||
mgr, err := NewAddrBook(context.Background(), ds, opts)
|
||||
ab, err := NewAddrBook(context.Background(), store, opts)
|
||||
if err != nil {
|
||||
tb.Fatal(err)
|
||||
}
|
||||
|
||||
closeFunc := func() {
|
||||
mgr.Stop()
|
||||
closeDB()
|
||||
}
|
||||
return mgr, closeFunc
|
||||
return ab, closeFunc
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user