Skip to content

Commit

Permalink
Add find peer success addr to peerstore (ipfs#296)
Browse files Browse the repository at this point in the history
When a peer is found, add its addr to the peerstore, just like the addresses for closer peers are added. In particular this is helpful for followup queries by the DHT user.
  • Loading branch information
anacrolix committed Mar 12, 2019
1 parent 07573a0 commit ac67725
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions query.go
Expand Up @@ -297,6 +297,9 @@ func (r *dhtQueryRunner) queryPeer(proc process.Process, p peer.ID) {
r.Lock()
r.result = res
r.Unlock()
if res.peer != nil {
r.query.dht.peerstore.AddAddrs(res.peer.ID, res.peer.Addrs, pstore.TempAddrTTL)
}
go r.proc.Close() // signal to everyone that we're done.
// must be async, as we're one of the children, and Close blocks.

Expand Down

0 comments on commit ac67725

Please sign in to comment.