mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-04 04:56:16 +08:00
Merge pull request #1890 from ipfs/fix/bitswapLogging
bitswap: clean log printf and humanize dup data count
This commit is contained in:
@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/dustin/go-humanize"
|
||||
|
||||
key "github.com/ipfs/go-ipfs/blocks/key"
|
||||
cmds "github.com/ipfs/go-ipfs/commands"
|
||||
bitswap "github.com/ipfs/go-ipfs/exchange/bitswap"
|
||||
@ -156,7 +158,7 @@ var bitswapStatCmd = &cmds.Command{
|
||||
fmt.Fprintf(buf, "\tprovides buffer: %d / %d\n", out.ProvideBufLen, bitswap.HasBlockBufferSize)
|
||||
fmt.Fprintf(buf, "\tblocks received: %d\n", out.BlocksReceived)
|
||||
fmt.Fprintf(buf, "\tdup blocks received: %d\n", out.DupBlksReceived)
|
||||
fmt.Fprintf(buf, "\tdup data received: %d\n", out.DupDataReceived)
|
||||
fmt.Fprintf(buf, "\tdup data received: %s\n", humanize.Bytes(out.DupDataReceived))
|
||||
fmt.Fprintf(buf, "\twantlist [%d keys]\n", len(out.Wantlist))
|
||||
for _, k := range out.Wantlist {
|
||||
fmt.Fprintf(buf, "\t\t%s\n", k.B58String())
|
||||
|
@ -308,7 +308,7 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg
|
||||
var keys []key.Key
|
||||
for _, block := range iblocks {
|
||||
if _, found := bs.wm.wl.Contains(block.Key()); !found {
|
||||
log.Info("received un-asked-for block: %s", block)
|
||||
log.Infof("received un-asked-for %s from %s", block, p)
|
||||
continue
|
||||
}
|
||||
keys = append(keys, block.Key())
|
||||
|
Reference in New Issue
Block a user