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
Commits
1aafd285
Commit
1aafd285
authored
Oct 08, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add in some extra debug logging, and increase routing table latencies
parent
093c8fb0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
2 deletions
+8
-2
routing/dht/dht.go
routing/dht/dht.go
+2
-2
routing/dht/handlers.go
routing/dht/handlers.go
+1
-0
routing/dht/routing.go
routing/dht/routing.go
+1
-0
routing/kbucket/table.go
routing/kbucket/table.go
+4
-0
No files found.
routing/dht/dht.go
View file @
1aafd285
...
...
@@ -67,8 +67,8 @@ func NewDHT(p *peer.Peer, ps peer.Peerstore, net inet.Network, sender inet.Sende
dht
.
providers
=
NewProviderManager
(
p
.
ID
)
dht
.
routingTables
=
make
([]
*
kb
.
RoutingTable
,
3
)
dht
.
routingTables
[
0
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Millisecond
*
3
0
)
dht
.
routingTables
[
1
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Millisecond
*
100
)
dht
.
routingTables
[
0
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Millisecond
*
100
0
)
dht
.
routingTables
[
1
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Millisecond
*
100
0
)
dht
.
routingTables
[
2
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Hour
)
dht
.
birth
=
time
.
Now
()
return
dht
...
...
routing/dht/handlers.go
View file @
1aafd285
...
...
@@ -137,6 +137,7 @@ func (dht *IpfsDHT) handleGetProviders(p *peer.Peer, pmes *Message) (*Message, e
resp
:=
newMessage
(
pmes
.
GetType
(),
pmes
.
GetKey
(),
pmes
.
GetClusterLevel
())
// check if we have this value, to add ourselves as provider.
log
.
Debug
(
"handling GetProviders: '%s'"
,
pmes
.
GetKey
())
dsk
:=
u
.
Key
(
pmes
.
GetKey
())
.
DsKey
()
has
,
err
:=
dht
.
datastore
.
Has
(
dsk
)
if
err
!=
nil
&&
err
!=
ds
.
ErrNotFound
{
...
...
routing/dht/routing.go
View file @
1aafd285
...
...
@@ -192,6 +192,7 @@ func (dht *IpfsDHT) FindProviders(ctx context.Context, key u.Key) ([]*peer.Peer,
log
.
Debug
(
"Find providers for: '%s'"
,
key
)
p
:=
dht
.
routingTables
[
0
]
.
NearestPeer
(
kb
.
ConvertKey
(
key
))
if
p
==
nil
{
log
.
Warning
(
"Got no nearest peer for find providers: '%s'"
,
key
)
return
nil
,
nil
}
...
...
routing/kbucket/table.go
View file @
1aafd285
...
...
@@ -11,6 +11,8 @@ import (
u
"github.com/jbenet/go-ipfs/util"
)
var
log
=
u
.
Logger
(
"table"
)
// RoutingTable defines the routing table.
type
RoutingTable
struct
{
...
...
@@ -138,6 +140,8 @@ func (rt *RoutingTable) NearestPeer(id ID) *peer.Peer {
if
len
(
peers
)
>
0
{
return
peers
[
0
]
}
log
.
Error
(
"NearestPeer: Returning nil, table size = %d"
,
rt
.
Size
())
return
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