remove randomwalk

This commit is contained in:
SionoiS 2026-04-17 10:06:19 -04:00
parent ab995c0a8e
commit c8acdbbb3e
No known key found for this signature in database
GPG Key ID: C9458A8CB1852951
2 changed files with 12 additions and 10 deletions

View File

@ -25,7 +25,7 @@ type WakuKademlia* = ref object
protocol*: KademliaDiscovery
peerManager: PeerManager
loopInterval: Duration
periodicWalkFut: Future[void]
#periodicWalkFut: Future[void]
periodicLookupFut: Future[void]
proc toRemotePeerInfo(record: ExtendedPeerRecord): Option[RemotePeerInfo] =
@ -67,7 +67,7 @@ proc toRemotePeerInfo(record: ExtendedPeerRecord): Option[RemotePeerInfo] =
)
)
proc randomWalk*(
#[ proc randomWalk*(
self: WakuKademlia
): Future[seq[RemotePeerInfo]] {.async: (raises: []).} =
let res = catch:
@ -90,7 +90,7 @@ proc randomWalk*(
peerInfos.add(peerInfo)
return peerInfos
return peerInfos ]#
proc lookup*(
self: WakuKademlia, codec: string
@ -124,7 +124,7 @@ proc lookup*(
return peerInfos
proc periodicRandomWalk(
#[ proc periodicRandomWalk(
self: WakuKademlia, interval: Duration
) {.async: (raises: [CancelledError]).} =
debug "periodic random walk started", interval = interval
@ -132,7 +132,7 @@ proc periodicRandomWalk(
while true:
await sleepAsync(interval)
discard await self.randomWalk()
discard await self.randomWalk() ]#
proc periodicLookup(
self: WakuKademlia, interval: Duration
@ -173,8 +173,8 @@ proc new*(
)
proc start*(self: WakuKademlia) =
if self.periodicWalkFut.isNil():
self.periodicWalkFut = self.periodicRandomWalk(self.loopInterval)
#if self.periodicWalkFut.isNil():
#self.periodicWalkFut = self.periodicRandomWalk(self.loopInterval)
if self.periodicLookupFut.isNil():
self.periodicLookupFut = self.periodicLookup(self.loopInterval)

View File

@ -573,7 +573,8 @@ proc start*(node: WakuNode) {.async.} =
if not node.wakuRendezvousClient.isNil():
await node.wakuRendezvousClient.start()
node.wakuKademlia.start()
if not node.wakuKademlia.isNil():
node.wakuKademlia.start()
## The switch uses this mapper to update peer info addrs
## with announced addrs after start
@ -618,8 +619,6 @@ proc stop*(node: WakuNode) {.async.} =
node.peerManager.stop()
node.wakuKademlia.stop()
if not node.wakuRlnRelay.isNil():
try:
await node.wakuRlnRelay.stop() ## this can raise an exception
@ -642,6 +641,9 @@ proc stop*(node: WakuNode) {.async.} =
if not node.wakuRendezvousClient.isNil():
await node.wakuRendezvousClient.stopWait()
if not node.wakuKademlia.isNil():
node.wakuKademlia.stop()
node.started = false
proc isReady*(node: WakuNode): Future[bool] {.async: (raises: [Exception]).} =