Commit ae90a1ef authored by Steven Allen's avatar Steven Allen

test: close peerstore when closing the test swarm

parent bfc3909f
......@@ -10,6 +10,7 @@ import (
"github.com/libp2p/go-libp2p-testing/net"
"github.com/libp2p/go-tcp-transport"
goprocess "github.com/jbenet/goprocess"
csms "github.com/libp2p/go-conn-security-multistream"
pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem"
secio "github.com/libp2p/go-libp2p-secio"
......@@ -72,6 +73,7 @@ func GenSwarm(t *testing.T, ctx context.Context, opts ...Option) *swarm.Swarm {
ps.AddPubKey(p.ID, p.PubKey)
ps.AddPrivKey(p.ID, p.PrivKey)
s := swarm.NewSwarm(ctx, p.ID, ps, metrics.NewBandwidthCounter())
s.Process().AddChild(goprocess.WithTeardown(ps.Close))
tcpTransport := tcp.NewTCPTransport(GenUpgrader(s))
tcpTransport.DisableReuseport = cfg.disableReuseport
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment