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
dms3
go-dms3
Commits
7648a8b5
Commit
7648a8b5
authored
10 years ago
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm tests: dont send to self
parent
bc2d35fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
net/swarm2/swarm_test.go
net/swarm2/swarm_test.go
+7
-3
No files found.
net/swarm2/swarm_test.go
View file @
7648a8b5
...
...
@@ -127,7 +127,7 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) {
wg
.
Wait
()
for
_
,
s
:=
range
swarms
{
log
.
Infof
(
"%s swarm routing table: %s"
,
s
.
local
,
s
.
Get
Peer
List
())
log
.
Infof
(
"%s swarm routing table: %s"
,
s
.
local
,
s
.
Peer
s
())
}
}
...
...
@@ -174,6 +174,10 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) {
}
for
_
,
p
:=
range
*
peers
{
if
p
==
s1
.
local
{
continue
// dont send to self...
}
wg
.
Add
(
1
)
go
send
(
p
)
}
...
...
@@ -184,7 +188,7 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) {
go
func
()
{
defer
close
(
errChan
)
count
:=
0
countShouldBe
:=
(
MsgNum
*
len
(
*
peers
))
countShouldBe
:=
MsgNum
*
(
len
(
*
peers
)
-
1
)
for
stream
:=
range
streamChan
{
// one per peer
defer
stream
.
Close
()
...
...
@@ -228,7 +232,7 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) {
}
log
.
Debugf
(
"%s got pongs"
,
s1
.
local
)
if
len
(
*
peers
)
!=
len
(
got
)
{
if
(
len
(
*
peers
)
-
1
)
!=
len
(
got
)
{
t
.
Error
(
"got less messages than sent"
)
}
...
...
This diff is collapsed.
Click to expand it.
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