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-dms3-routing
Commits
6509dc17
Commit
6509dc17
authored
Dec 23, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
routing table: better printing (see bkts)
parent
22e98350
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
kbucket/table.go
kbucket/table.go
+10
-3
No files found.
kbucket/table.go
View file @
6509dc17
...
...
@@ -223,9 +223,16 @@ func (rt *RoutingTable) ListPeers() []peer.ID {
func
(
rt
*
RoutingTable
)
Print
()
{
fmt
.
Printf
(
"Routing Table, bs = %d, Max latency = %d
\n
"
,
rt
.
bucketsize
,
rt
.
maxLatency
)
rt
.
tabLock
.
RLock
()
peers
:=
rt
.
ListPeers
()
for
i
,
p
:=
range
peers
{
fmt
.
Printf
(
"%d) %s %s
\n
"
,
i
,
p
.
Pretty
(),
rt
.
metrics
.
LatencyEWMA
(
p
)
.
String
())
for
i
,
b
:=
range
rt
.
Buckets
{
fmt
.
Printf
(
"
\t
bucket: %d
\n
"
,
i
)
b
.
lk
.
RLock
()
for
e
:=
b
.
list
.
Front
();
e
!=
nil
;
e
=
e
.
Next
()
{
p
:=
e
.
Value
.
(
peer
.
ID
)
fmt
.
Printf
(
"
\t\t
- %s %s
\n
"
,
p
.
Pretty
(),
rt
.
metrics
.
LatencyEWMA
(
p
)
.
String
())
}
b
.
lk
.
RUnlock
()
}
rt
.
tabLock
.
RUnlock
()
}
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