mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2024-12-28 23:50:12 +08:00
fix nil dereference in benchmarks.
This commit is contained in:
parent
039ee3a7b1
commit
580527bc73
@ -42,9 +42,12 @@ func TestPeerstore(t *testing.T, factory PeerstoreFactory) {
|
|||||||
|
|
||||||
func BenchmarkPeerstore(b *testing.B, factory PeerstoreFactory) {
|
func BenchmarkPeerstore(b *testing.B, factory PeerstoreFactory) {
|
||||||
ps, closeFunc := factory()
|
ps, closeFunc := factory()
|
||||||
defer closeFunc()
|
|
||||||
|
|
||||||
b.Run("Peerstore", benchmarkPeerstore(ps))
|
b.Run("Peerstore", benchmarkPeerstore(ps))
|
||||||
|
|
||||||
|
if closeFunc != nil {
|
||||||
|
closeFunc()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAddrStream(ps pstore.Peerstore) func(t *testing.T) {
|
func testAddrStream(ps pstore.Peerstore) func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user