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
7e405030
Commit
7e405030
authored
Feb 21, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dont potentially kill our memory
parent
7c0c3c45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
routing/dht/routing.go
routing/dht/routing.go
+2
-3
No files found.
routing/dht/routing.go
View file @
7e405030
package
dht
import
(
"math"
"sync"
"time"
...
...
@@ -89,7 +88,7 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key u.Key) ([]byte, error) {
// get closest peers in the routing table
rtp
:=
dht
.
routingTable
.
ListPeers
()
log
.
Debug
f
(
"peers in rt: %s"
,
len
(
rtp
),
rtp
)
log
.
Error
f
(
"peers in rt: %s"
,
len
(
rtp
),
rtp
)
if
len
(
rtp
)
==
0
{
log
.
Warning
(
"No peers from routing table!"
)
return
nil
,
errors
.
Wrap
(
kb
.
ErrLookupFailure
)
...
...
@@ -169,7 +168,7 @@ func (dht *IpfsDHT) Provide(ctx context.Context, key u.Key) error {
// FindProviders searches until the context expires.
func
(
dht
*
IpfsDHT
)
FindProviders
(
ctx
context
.
Context
,
key
u
.
Key
)
([]
peer
.
PeerInfo
,
error
)
{
var
providers
[]
peer
.
PeerInfo
for
p
:=
range
dht
.
FindProvidersAsync
(
ctx
,
key
,
math
.
MaxInt32
)
{
for
p
:=
range
dht
.
FindProvidersAsync
(
ctx
,
key
,
KValue
)
{
providers
=
append
(
providers
,
p
)
}
return
providers
,
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