Remove local providers (#268)
* add remove provider method * remove failed providers * bumping dht to latest master
This commit is contained in:
parent
58f0439f37
commit
106b04340a
|
@ -152,8 +152,14 @@ proc discoveryTaskLoop(b: DiscoveryEngine) {.async.} =
|
||||||
peers = await request
|
peers = await request
|
||||||
|
|
||||||
trace "Discovered peers", peers = peers.len
|
trace "Discovered peers", peers = peers.len
|
||||||
checkFutures(
|
let
|
||||||
await allFinished(peers.mapIt( b.network.dialPeer(it.data))))
|
dialed = await allFinished(
|
||||||
|
peers.mapIt( b.network.dialPeer(it.data) ))
|
||||||
|
|
||||||
|
for i, f in dialed:
|
||||||
|
if f.failed:
|
||||||
|
await b.discovery.removeProvider(peers[i].data.peerId)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
b.inFlightDiscReqs.del(cid)
|
b.inFlightDiscReqs.del(cid)
|
||||||
codex_inflight_discovery.set(b.inFlightAdvReqs.len.int64)
|
codex_inflight_discovery.set(b.inFlightAdvReqs.len.int64)
|
||||||
|
|
|
@ -137,6 +137,13 @@ method provide*(d: Discovery, host: ca.Address) {.async, base.} =
|
||||||
if nodes.len > 0:
|
if nodes.len > 0:
|
||||||
trace "Provided to nodes", nodes = nodes.len
|
trace "Provided to nodes", nodes = nodes.len
|
||||||
|
|
||||||
|
method removeProvider*(d: Discovery, peerId: PeerId): Future[void] =
|
||||||
|
## Remove provider from providers table
|
||||||
|
##
|
||||||
|
|
||||||
|
trace "Removing provider", peerId
|
||||||
|
d.protocol.removeProvidersLocal(peerId)
|
||||||
|
|
||||||
proc start*(d: Discovery) {.async.} =
|
proc start*(d: Discovery) {.async.} =
|
||||||
d.protocol.updateRecord(
|
d.protocol.updateRecord(
|
||||||
d.localInfo.signedPeerRecord.some)
|
d.localInfo.signedPeerRecord.some)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4b9fa0356e6cefbbbcedcf21a914cda575229774
|
Subproject commit 08928e57d82736ab9524010a3bd59a707f2e0769
|
Loading…
Reference in New Issue