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
77e81da9
Commit
77e81da9
authored
May 17, 2015
by
Jeromy
Committed by
Juan Batiz-Benet
May 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better bitswap logging
parent
4d5b93fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
bitswap.go
bitswap.go
+1
-1
wantmanager.go
wantmanager.go
+4
-1
No files found.
bitswap.go
View file @
77e81da9
...
@@ -288,7 +288,7 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg
...
@@ -288,7 +288,7 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg
bs
.
dupBlocksRecvd
++
bs
.
dupBlocksRecvd
++
}
}
bs
.
counterLk
.
Unlock
()
bs
.
counterLk
.
Unlock
()
log
.
Debug
f
(
"got block %s from %s (%d,%d)"
,
block
,
p
,
bs
.
blocksRecvd
,
bs
.
dupBlocksRecvd
)
log
.
Info
f
(
"got block %s from %s (%d,%d)"
,
block
,
p
,
bs
.
blocksRecvd
,
bs
.
dupBlocksRecvd
)
hasBlockCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
hasBlockTimeout
)
hasBlockCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
hasBlockTimeout
)
if
err
:=
bs
.
HasBlock
(
hasBlockCtx
,
block
);
err
!=
nil
{
if
err
:=
bs
.
HasBlock
(
hasBlockCtx
,
block
);
err
!=
nil
{
...
...
wantmanager.go
View file @
77e81da9
...
@@ -66,6 +66,7 @@ type msgQueue struct {
...
@@ -66,6 +66,7 @@ type msgQueue struct {
}
}
func
(
pm
*
WantManager
)
WantBlocks
(
ks
[]
u
.
Key
)
{
func
(
pm
*
WantManager
)
WantBlocks
(
ks
[]
u
.
Key
)
{
log
.
Infof
(
"want blocks: %s"
,
ks
)
pm
.
addEntries
(
ks
,
false
)
pm
.
addEntries
(
ks
,
false
)
}
}
...
@@ -97,6 +98,7 @@ func (pm *WantManager) SendBlock(ctx context.Context, env *engine.Envelope) {
...
@@ -97,6 +98,7 @@ func (pm *WantManager) SendBlock(ctx context.Context, env *engine.Envelope) {
msg
:=
bsmsg
.
New
(
false
)
msg
:=
bsmsg
.
New
(
false
)
msg
.
AddBlock
(
env
.
Block
)
msg
.
AddBlock
(
env
.
Block
)
log
.
Infof
(
"Sending block %s to %s"
,
env
.
Peer
,
env
.
Block
)
err
:=
pm
.
network
.
SendMessage
(
ctx
,
env
.
Peer
,
msg
)
err
:=
pm
.
network
.
SendMessage
(
ctx
,
env
.
Peer
,
msg
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
...
@@ -143,8 +145,9 @@ func (pm *WantManager) runQueue(mq *msgQueue) {
...
@@ -143,8 +145,9 @@ func (pm *WantManager) runQueue(mq *msgQueue) {
err
:=
pm
.
network
.
ConnectTo
(
pm
.
ctx
,
mq
.
p
)
err
:=
pm
.
network
.
ConnectTo
(
pm
.
ctx
,
mq
.
p
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
f
(
"cant connect to peer %s: %s"
,
mq
.
p
,
err
)
// TODO: cant connect, what now?
// TODO: cant connect, what now?
continue
}
}
// grab outgoing message
// grab outgoing message
...
...
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