Skip to content

Commit

Permalink
fix: start host
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol committed Jun 8, 2023
1 parent f02a762 commit 7005cd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/p2p/libp2p/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestMain(m *testing.M) {
goleak.IgnoreTopFunction("sync.runtime_Semacquire"),
goleak.IgnoreTopFunction("net.ParseCIDR"),
goleak.IgnoreTopFunction("github.com/ipfs/go-log/writer.(*MirrorWriter).logRoutine"),
goleak.IgnoreTopFunction("github.com/libp2p/go-flow-metrics.(*sweeper).runActive"),
goleak.IgnoreTopFunction("github.com/huin/goupnp/httpu.(*MultiClient).Do.func2"),
goleak.IgnoreTopFunction("github.com/libp2p/go-flow-metrics.(*sweeper).run"),
goleak.IgnoreTopFunction("github.com/libp2p/go-cidranger.(*prefixTrie).insert"),
Expand Down
11 changes: 8 additions & 3 deletions pkg/p2p/libp2p/protocols_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,21 @@ func TestPing(t *testing.T) {

s1, _ := newService(t, 1, libp2pServiceOpts{
libp2pOpts: libp2p.WithHostFactory(
func(_ ...libp2pm.Option) (host.Host, error) {
func(...libp2pm.Option) (host.Host, error) {
return bhost.NewHost(swarmt.GenSwarm(t), &bhost.HostOpts{EnablePing: true})
},
),
})

s2, _ := newService(t, 1, libp2pServiceOpts{
libp2pOpts: libp2p.WithHostFactory(
func(_ ...libp2pm.Option) (host.Host, error) {
return bhost.NewHost(swarmt.GenSwarm(t), &bhost.HostOpts{EnablePing: true})
func(...libp2pm.Option) (host.Host, error) {
host, err := bhost.NewHost(swarmt.GenSwarm(t), &bhost.HostOpts{EnablePing: true})
if err != nil {
t.Fatalf("start host: %v", err)
}
host.Start()
return host, nil
},
),
})
Expand Down

0 comments on commit 7005cd6

Please sign in to comment.