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
4c5fb600
Commit
4c5fb600
authored
Jun 10, 2019
by
Jakub Sztandera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enchanced logging for bitswap
License: MIT Signed-off-by:
Jakub Sztandera
<
kubuxu@protonmail.ch
>
parent
86089ee1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
bitswap.go
bitswap.go
+2
-1
wantmanager/wantmanager.go
wantmanager/wantmanager.go
+2
-1
No files found.
bitswap.go
View file @
4c5fb600
...
...
@@ -334,10 +334,11 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg
bs
.
updateReceiveCounters
(
b
)
bs
.
sm
.
UpdateReceiveCounters
(
b
)
log
.
Debugf
(
"
got block %s from %s"
,
b
,
p
)
log
.
Debugf
(
"
[recv] block; cid=%s, peer=%s"
,
b
.
Cid
()
,
p
)
// skip received blocks that are not in the wantlist
if
!
bs
.
wm
.
IsWanted
(
b
.
Cid
())
{
log
.
Debugf
(
"[recv] block not in wantlist; cid=%s, peer=%s"
,
b
.
Cid
(),
p
)
return
}
...
...
wantmanager/wantmanager.go
View file @
4c5fb600
...
...
@@ -70,12 +70,13 @@ func New(ctx context.Context, peerHandler PeerHandler) *WantManager {
// WantBlocks adds the given cids to the wantlist, tracked by the given session.
func
(
wm
*
WantManager
)
WantBlocks
(
ctx
context
.
Context
,
ks
[]
cid
.
Cid
,
peers
[]
peer
.
ID
,
ses
uint64
)
{
log
.
Infof
(
"want blocks: %s"
,
k
s
)
log
.
Debugf
(
"[wantlist] want blocks; cids=%s, peers=%s, ses=%d"
,
ks
,
peers
,
se
s
)
wm
.
addEntries
(
ctx
,
ks
,
peers
,
false
,
ses
)
}
// CancelWants removes the given cids from the wantlist, tracked by the given session.
func
(
wm
*
WantManager
)
CancelWants
(
ctx
context
.
Context
,
ks
[]
cid
.
Cid
,
peers
[]
peer
.
ID
,
ses
uint64
)
{
log
.
Debugf
(
"[wantlist] unwant blocks; cids=%s, peers=%s, ses=%d"
,
ks
,
peers
,
ses
)
wm
.
addEntries
(
context
.
Background
(),
ks
,
peers
,
true
,
ses
)
}
...
...
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