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
1b7c0b14
Commit
1b7c0b14
authored
Dec 02, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary concurrency in last commit
parent
90f5ec0c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
+4
-14
bitswap.go
bitswap.go
+3
-13
bitswap_test.go
bitswap_test.go
+1
-1
No files found.
bitswap.go
View file @
1b7c0b14
...
@@ -253,20 +253,10 @@ func (bs *bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
...
@@ -253,20 +253,10 @@ func (bs *bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
bs
.
wantlist
.
Remove
(
blk
.
Key
())
bs
.
wantlist
.
Remove
(
blk
.
Key
())
bs
.
notifications
.
Publish
(
blk
)
bs
.
notifications
.
Publish
(
blk
)
var
err
error
wg
:=
&
sync
.
WaitGroup
{}
wg
.
Add
(
2
)
child
,
_
:=
context
.
WithTimeout
(
ctx
,
hasBlockTimeout
)
child
,
_
:=
context
.
WithTimeout
(
ctx
,
hasBlockTimeout
)
go
func
()
{
bs
.
sendToPeersThatWant
(
child
,
blk
)
bs
.
sendToPeersThatWant
(
child
,
blk
)
wg
.
Done
()
child
,
_
=
context
.
WithTimeout
(
ctx
,
hasBlockTimeout
)
}()
return
bs
.
routing
.
Provide
(
child
,
blk
.
Key
())
go
func
()
{
err
=
bs
.
routing
.
Provide
(
child
,
blk
.
Key
())
wg
.
Done
()
}()
wg
.
Wait
()
return
err
}
}
// receiveBlock handles storing the block in the blockstore and calling HasBlock
// receiveBlock handles storing the block in the blockstore and calling HasBlock
...
...
bitswap_test.go
View file @
1b7c0b14
...
@@ -235,7 +235,7 @@ func TestSendToWantingPeer(t *testing.T) {
...
@@ -235,7 +235,7 @@ func TestSendToWantingPeer(t *testing.T) {
t
.
Logf
(
"%v should now have %v
\n
"
,
w
.
Peer
,
alpha
.
Key
())
t
.
Logf
(
"%v should now have %v
\n
"
,
w
.
Peer
,
alpha
.
Key
())
block
,
err
:=
w
.
Blockstore
.
Get
(
alpha
.
Key
())
block
,
err
:=
w
.
Blockstore
.
Get
(
alpha
.
Key
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
"Should not have received an error
"
)
t
.
Fatal
f
(
"Should not have received an error
: %s"
,
err
)
}
}
if
block
.
Key
()
!=
alpha
.
Key
()
{
if
block
.
Key
()
!=
alpha
.
Key
()
{
t
.
Fatal
(
"Expected to receive alpha from me"
)
t
.
Fatal
(
"Expected to receive alpha from me"
)
...
...
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