Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Increase logging and wait for DHT to bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmabc authored and drwasho committed Sep 21, 2020
1 parent eb0ae2a commit 294cfeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ipfs/pointers.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func PutPointerToPeer(dht *routing.IpfsDHT, ctx context.Context, peer peer.ID, p

func GetPointersFromPeer(dht *routing.IpfsDHT, ctx context.Context, p peer.ID, key *cid.Cid) ([]*ps.PeerInfo, error) {
pmes := dhtpb.NewMessage(dhtpb.Message_GET_PROVIDERS, key.Bytes(), 0)
log.Debugf("Fetching pointers from: %v\n", p.Pretty())
resp, err := dht.SendRequest(ctx, p, pmes)
if err != nil {
return []*ps.PeerInfo{}, err
Expand Down
5 changes: 4 additions & 1 deletion net/retriever/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,15 @@ func (m *MessageRetriever) getPointersFromDataPeersRoutine(peerOut chan ps.PeerI
wg.Add(1)
go func(pid peer.ID) {
defer wg.Done()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*35)
defer cancel()
time.Sleep(time.Second*15)
provs, err := ipfs.GetPointersFromPeer(m.routing, ctx, pid, &k)
if err != nil {
log.Errorf("Could not get pointers from push node because: %v", err)
return
}
log.Debugf("Successfully queried %s for pointers", pid.Pretty())
for _, pi := range provs {
peerOut <- *pi
}
Expand Down

0 comments on commit 294cfeb

Please sign in to comment.