Skip to content

Commit

Permalink
Merge pull request #33 from libp2p/fix/100
Browse files Browse the repository at this point in the history
test: connect each peer precisely once.
  • Loading branch information
Stebalien authored Aug 31, 2017
2 parents bb8f8d0 + 755830e commit addbd7c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions p2p/net/swarm/swarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ func connectSwarms(t *testing.T, ctx context.Context, swarms []*Swarm) {
}

log.Info("Connecting swarms simultaneously.")
for _, s1 := range swarms {
for _, s2 := range swarms {
if s2.local != s1.local { // don't connect to self.
wg.Add(1)
connect(s1, s2.LocalPeer(), s2.ListenAddresses()[0]) // try the first.
}
for i, s1 := range swarms {
for _, s2 := range swarms[i+1:] {
wg.Add(1)
connect(s1, s2.LocalPeer(), s2.ListenAddresses()[0]) // try the first.
}
}
wg.Wait()
Expand Down

0 comments on commit addbd7c

Please sign in to comment.