mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-06 07:53:12 +00:00
added randomness to peer selection (#3123)
This commit is contained in:
parent
086820a49b
commit
6cfa477817
@ -227,6 +227,8 @@ proc selectPeer*(
|
|||||||
if shard.isSome():
|
if shard.isSome():
|
||||||
peers.keepItIf((it.enr.isSome() and it.enr.get().containsShard(shard.get())))
|
peers.keepItIf((it.enr.isSome() and it.enr.get().containsShard(shard.get())))
|
||||||
|
|
||||||
|
shuffle(peers)
|
||||||
|
|
||||||
# No criteria for selecting a peer for WakuRelay, random one
|
# No criteria for selecting a peer for WakuRelay, random one
|
||||||
if proto == WakuRelayCodec:
|
if proto == WakuRelayCodec:
|
||||||
# TODO: proper heuristic here that compares peer scores and selects "best" one. For now the first peer for the given protocol is returned
|
# TODO: proper heuristic here that compares peer scores and selects "best" one. For now the first peer for the given protocol is returned
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user