Unverified Commit 1db259d1 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #139 from libp2p/fix/close-peerstore-testing

test: close peerstore when closing the test swarm
parents bfc3909f ae90a1ef
......@@ -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