Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
1db259d1
Unverified
Commit
1db259d1
authored
Sep 18, 2019
by
Steven Allen
Committed by
GitHub
Sep 18, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #139 from libp2p/fix/close-peerstore-testing
test: close peerstore when closing the test swarm
parents
bfc3909f
ae90a1ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
testing/testing.go
testing/testing.go
+2
-0
No files found.
testing/testing.go
View file @
1db259d1
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
"github.com/libp2p/go-libp2p-testing/net"
"github.com/libp2p/go-libp2p-testing/net"
"github.com/libp2p/go-tcp-transport"
"github.com/libp2p/go-tcp-transport"
goprocess
"github.com/jbenet/goprocess"
csms
"github.com/libp2p/go-conn-security-multistream"
csms
"github.com/libp2p/go-conn-security-multistream"
pstoremem
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
pstoremem
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
secio
"github.com/libp2p/go-libp2p-secio"
secio
"github.com/libp2p/go-libp2p-secio"
...
@@ -72,6 +73,7 @@ func GenSwarm(t *testing.T, ctx context.Context, opts ...Option) *swarm.Swarm {
...
@@ -72,6 +73,7 @@ func GenSwarm(t *testing.T, ctx context.Context, opts ...Option) *swarm.Swarm {
ps
.
AddPubKey
(
p
.
ID
,
p
.
PubKey
)
ps
.
AddPubKey
(
p
.
ID
,
p
.
PubKey
)
ps
.
AddPrivKey
(
p
.
ID
,
p
.
PrivKey
)
ps
.
AddPrivKey
(
p
.
ID
,
p
.
PrivKey
)
s
:=
swarm
.
NewSwarm
(
ctx
,
p
.
ID
,
ps
,
metrics
.
NewBandwidthCounter
())
s
:=
swarm
.
NewSwarm
(
ctx
,
p
.
ID
,
ps
,
metrics
.
NewBandwidthCounter
())
s
.
Process
()
.
AddChild
(
goprocess
.
WithTeardown
(
ps
.
Close
))
tcpTransport
:=
tcp
.
NewTCPTransport
(
GenUpgrader
(
s
))
tcpTransport
:=
tcp
.
NewTCPTransport
(
GenUpgrader
(
s
))
tcpTransport
.
DisableReuseport
=
cfg
.
disableReuseport
tcpTransport
.
DisableReuseport
=
cfg
.
disableReuseport
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment