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-bitswap
Commits
b7660f5f
Commit
b7660f5f
authored
Sep 19, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(bitswap:testnet) shuffle the providers
to avoid letting client rely on order for correctness
parent
e040a00a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
testnet/routing.go
testnet/routing.go
+7
-0
No files found.
testnet/routing.go
View file @
b7660f5f
...
...
@@ -2,6 +2,7 @@ package bitswap
import
(
"errors"
"math/rand"
"sync"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
...
...
@@ -58,6 +59,12 @@ func (rs *hashTable) Providers(k u.Key) []*peer.Peer {
for
_
,
peer
:=
range
peerset
{
ret
=
append
(
ret
,
peer
)
}
for
i
:=
range
ret
{
j
:=
rand
.
Intn
(
i
+
1
)
ret
[
i
],
ret
[
j
]
=
ret
[
j
],
ret
[
i
]
}
return
ret
}
...
...
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