| 2549 | } |
| 2550 | |
| 2551 | bool CConnman::MaybePickPreferredNetwork(std::optional<Network>& network) |
| 2552 | { |
| 2553 | AssertLockNotHeld(m_nodes_mutex); |
| 2554 | |
| 2555 | std::array<Network, 5> nets{NET_IPV4, NET_IPV6, NET_ONION, NET_I2P, NET_CJDNS}; |
| 2556 | std::shuffle(nets.begin(), nets.end(), FastRandomContext()); |
| 2557 | |
| 2558 | LOCK(m_nodes_mutex); |
| 2559 | for (const auto net : nets) { |
| 2560 | if (g_reachable_nets.Contains(net) && m_network_conn_counts[net] == 0 && addrman.get().Size(net) != 0) { |
| 2561 | network = net; |
| 2562 | return true; |
| 2563 | } |
| 2564 | } |
| 2565 | |
| 2566 | return false; |
| 2567 | } |
| 2568 | |
| 2569 | void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std::span<const std::string> seed_nodes) |
| 2570 | { |