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
3104b2da
Commit
3104b2da
authored
May 29, 2019
by
hannahhoward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(sessions): fix data race in test
parent
49a96fbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
session/session.go
session/session.go
+0
-2
session/session_test.go
session/session_test.go
+6
-5
No files found.
session/session.go
View file @
3104b2da
...
...
@@ -2,7 +2,6 @@ package session
import
(
"context"
"fmt"
"math/rand"
"time"
...
...
@@ -341,7 +340,6 @@ func (s *Session) handleTick(ctx context.Context) {
}
func
(
s
*
Session
)
handleRebroadcast
(
ctx
context
.
Context
)
{
fmt
.
Println
(
"Rebroadcast"
)
if
len
(
s
.
liveWants
)
==
0
{
return
...
...
session/session_test.go
View file @
3104b2da
...
...
@@ -260,8 +260,12 @@ func TestSessionFindMorePeers(t *testing.T) {
}
func
TestSessionFailingToGetFirstBlock
(
t
*
testing
.
T
)
{
SetProviderSearchDelay
(
10
*
time
.
Millisecond
)
defer
SetProviderSearchDelay
(
1
*
time
.
Second
)
SetRebroadcastDelay
(
delay
.
Fixed
(
100
*
time
.
Millisecond
))
defer
SetRebroadcastDelay
(
delay
.
Fixed
(
1
*
time
.
Minute
))
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
900
*
time
.
Millis
econd
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
2
*
time
.
S
econd
)
defer
cancel
()
wantReqs
:=
make
(
chan
wantReq
,
1
)
cancelReqs
:=
make
(
chan
wantReq
,
1
)
...
...
@@ -269,10 +273,7 @@ func TestSessionFailingToGetFirstBlock(t *testing.T) {
fpm
:=
&
fakePeerManager
{
findMorePeersRequested
:
make
(
chan
cid
.
Cid
,
1
)}
frs
:=
&
fakeRequestSplitter
{}
id
:=
testutil
.
GenerateSessionID
()
SetProviderSearchDelay
(
10
*
time
.
Millisecond
)
defer
SetProviderSearchDelay
(
1
*
time
.
Second
)
SetRebroadcastDelay
(
delay
.
Fixed
(
100
*
time
.
Millisecond
))
defer
SetRebroadcastDelay
(
delay
.
Fixed
(
1
*
time
.
Minute
))
session
:=
New
(
ctx
,
id
,
fwm
,
fpm
,
frs
)
blockGenerator
:=
blocksutil
.
NewBlockGenerator
()
blks
:=
blockGenerator
.
Blocks
(
4
)
...
...
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