Commit 92089f5a authored by Jeromy's avatar Jeromy

fix output formatting on stat

parent 5792e978
......@@ -40,7 +40,7 @@ const (
// kMaxPriority is the max priority as defined by the bitswap protocol
kMaxPriority = math.MaxInt32
hasBlockBufferSize = 256
HasBlockBufferSize = 256
provideWorkers = 4
)
......@@ -88,7 +88,7 @@ func New(parent context.Context, p peer.ID, network bsnet.BitSwapNetwork,
wantlist: wantlist.NewThreadSafe(),
batchRequests: make(chan *blockRequest, sizeBatchRequestChan),
process: px,
newBlocks: make(chan *blocks.Block, hasBlockBufferSize),
newBlocks: make(chan *blocks.Block, HasBlockBufferSize),
}
network.SetDelegate(bs)
......
package bitswap
import (
peer "github.com/jbenet/go-ipfs/p2p/peer"
u "github.com/jbenet/go-ipfs/util"
"sort"
)
type Stat struct {
ProvideBufLen int
Wantlist []u.Key
Peers []peer.ID
Peers []string
}
func (bs *Bitswap) Stat() (*Stat, error) {
......@@ -16,7 +16,10 @@ func (bs *Bitswap) Stat() (*Stat, error) {
st.ProvideBufLen = len(bs.newBlocks)
st.Wantlist = bs.GetWantlist()
st.Peers = bs.engine.Peers()
for _, p := range bs.engine.Peers() {
st.Peers = append(st.Peers, p.Pretty())
}
sort.Strings(st.Peers)
return st, nil
}
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