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
92089f5a
Commit
92089f5a
authored
Feb 20, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix output formatting on stat
parent
5792e978
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
bitswap.go
bitswap.go
+2
-2
stat.go
stat.go
+6
-3
No files found.
bitswap.go
View file @
92089f5a
...
...
@@ -40,7 +40,7 @@ const (
// kMaxPriority is the max priority as defined by the bitswap protocol
kMaxPriority
=
math
.
MaxInt32
h
asBlockBufferSize
=
256
H
asBlockBufferSize
=
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
,
h
asBlockBufferSize
),
newBlocks
:
make
(
chan
*
blocks
.
Block
,
H
asBlockBufferSize
),
}
network
.
SetDelegate
(
bs
)
...
...
stat.go
View file @
92089f5a
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
}
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