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
536feb6d
Unverified
Commit
536feb6d
authored
Jun 14, 2019
by
Steven Allen
Committed by
GitHub
Jun 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #144 from ipfs/fix/zero-rand
fix: rand.Intn(0) panics
parents
480b3f75
9f3ffaf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
session/session.go
session/session.go
+3
-0
No files found.
session/session.go
View file @
536feb6d
...
...
@@ -347,6 +347,9 @@ func (s *Session) handlePeriodicSearch(ctx context.Context) {
}
func
(
s
*
Session
)
randomLiveWant
()
cid
.
Cid
{
if
len
(
s
.
liveWants
)
==
0
{
return
cid
.
Cid
{}
}
i
:=
rand
.
Intn
(
len
(
s
.
liveWants
))
// picking a random live want
for
k
:=
range
s
.
liveWants
{
...
...
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