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
2ee030b6
Commit
2ee030b6
authored
Nov 26, 2014
by
Brian Tiger Chow
Committed by
Jeromy
Dec 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(bitswap) perform Publish in HasBlock
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
2be5de8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
bitswap.go
bitswap.go
+2
-2
No files found.
bitswap.go
View file @
2ee030b6
...
...
@@ -224,8 +224,10 @@ func (bs *bitswap) loop(parent context.Context) {
// HasBlock announces the existance of a block to this bitswap service. The
// service will potentially notify its peers.
func
(
bs
*
bitswap
)
HasBlock
(
ctx
context
.
Context
,
blk
*
blocks
.
Block
)
error
{
// TODO check all errors
log
.
Debugf
(
"Has Block %s"
,
blk
.
Key
())
bs
.
wantlist
.
Remove
(
blk
.
Key
())
bs
.
notifications
.
Publish
(
blk
)
bs
.
sendToPeersThatWant
(
ctx
,
blk
)
return
bs
.
routing
.
Provide
(
ctx
,
blk
.
Key
())
}
...
...
@@ -258,8 +260,6 @@ func (bs *bitswap) ReceiveMessage(ctx context.Context, p peer.Peer, incoming bsm
log
.
Criticalf
(
"error putting block: %s"
,
err
)
continue
// FIXME(brian): err ignored
}
bs
.
notifications
.
Publish
(
block
)
bs
.
wantlist
.
Remove
(
block
.
Key
())
err
:=
bs
.
HasBlock
(
ctx
,
block
)
if
err
!=
nil
{
log
.
Warningf
(
"HasBlock errored: %s"
,
err
)
...
...
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