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
p2p
go-p2p-kad-dht
Commits
f68587d2
Commit
f68587d2
authored
Sep 27, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpated commands and RPC dialing to work with new configuration changes
parent
be6003d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
routing.go
routing.go
+4
-4
No files found.
routing.go
View file @
f68587d2
...
...
@@ -59,7 +59,7 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key u.Key) ([]byte, error) {
routeLevel
:=
0
closest
:=
dht
.
routingTables
[
routeLevel
]
.
NearestPeers
(
kb
.
ConvertKey
(
key
),
PoolSize
)
if
closest
==
nil
||
len
(
closest
)
==
0
{
return
nil
,
kb
.
ErrLookupFailure
return
nil
,
nil
}
// setup the Query
...
...
@@ -101,7 +101,7 @@ func (dht *IpfsDHT) Provide(ctx context.Context, key u.Key) error {
dht
.
providers
.
AddProvider
(
key
,
dht
.
self
)
peers
:=
dht
.
routingTables
[
0
]
.
NearestPeers
(
kb
.
ConvertKey
(
key
),
PoolSize
)
if
len
(
peers
)
==
0
{
return
kb
.
ErrLookupFailure
return
nil
}
//TODO FIX: this doesn't work! it needs to be sent to the actual nearest peers.
...
...
@@ -245,7 +245,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (*peer.Peer, error
routeLevel
:=
0
p
=
dht
.
routingTables
[
routeLevel
]
.
NearestPeer
(
kb
.
ConvertPeerID
(
id
))
if
p
==
nil
{
return
nil
,
kb
.
ErrLookupFailure
return
nil
,
nil
}
if
p
.
ID
.
Equal
(
id
)
{
return
p
,
nil
...
...
@@ -287,7 +287,7 @@ func (dht *IpfsDHT) findPeerMultiple(ctx context.Context, id peer.ID) (*peer.Pee
routeLevel
:=
0
peers
:=
dht
.
routingTables
[
routeLevel
]
.
NearestPeers
(
kb
.
ConvertPeerID
(
id
),
AlphaValue
)
if
len
(
peers
)
==
0
{
return
nil
,
kb
.
ErrLookupFailure
return
nil
,
nil
}
// setup query function
...
...
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