mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 19:49:22 +00:00
Correct selection of to-try peers to prevent infinite loops when to-try < target
This commit is contained in:
parent
d94c9a4a5e
commit
19e68f7f75
1 changed files with 2 additions and 2 deletions
|
@ -493,8 +493,8 @@ impl LibP2p {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Randomly select up to 5
|
// Randomly select up to 2 * TARGET_PEERS
|
||||||
for _ in 0 .. 5 {
|
for _ in 0 .. (2 * TARGET_PEERS) {
|
||||||
if !nodes.is_empty() {
|
if !nodes.is_empty() {
|
||||||
let to_connect = nodes.swap_remove(
|
let to_connect = nodes.swap_remove(
|
||||||
usize::try_from(OsRng.next_u64() % u64::try_from(nodes.len()).unwrap())
|
usize::try_from(OsRng.next_u64() % u64::try_from(nodes.len()).unwrap())
|
||||||
|
|
Loading…
Reference in a new issue