Commit 7e405030 authored by Jeromy's avatar Jeromy

dont potentially kill our memory

parent 7c0c3c45
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.Debugf("peers in rt: %s", len(rtp), rtp)
log.Errorf("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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment