Unverified Commit 008c6933 authored by Jakub Sztandera's avatar Jakub Sztandera Committed by GitHub

Merge pull request #137 from ipfs/fire/logging

Enchanced logging for bitswap
parents 536feb6d 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
}
......
......@@ -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", ks)
log.Debugf("[wantlist] want blocks; cids=%s, peers=%s, ses=%d", ks, peers, ses)
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)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment