Unverified Commit ac677253 authored by Matt Joiner's avatar Matt Joiner Committed by GitHub

Add find peer success addr to peerstore (#296)

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.
parent 07573a0b
......@@ -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.
......
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