Changeset View
Changeset View
Standalone View
Standalone View
src/test/net_tests.cpp
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | bool checkContiguousAddressesConnection( | ||||
Mutex mutex; | Mutex mutex; | ||||
WAIT_LOCK(mutex, lock); | WAIT_LOCK(mutex, lock); | ||||
bool ret = cvar.wait_for(lock, 10s, [&]() { | bool ret = cvar.wait_for(lock, 10s, [&]() { | ||||
LOCK(cs); | LOCK(cs); | ||||
return outboundFullRelayCount == expectedOutboundFullRelayCount && | return outboundFullRelayCount == expectedOutboundFullRelayCount && | ||||
avalancheOutboundsCount == expectedAvalancheOutboundsCount; | avalancheOutboundsCount == expectedAvalancheOutboundsCount; | ||||
}); | }); | ||||
interruptNet(); | |||||
if (threadOpenConnections.joinable()) { | |||||
threadOpenConnections.join(); | |||||
} | |||||
// Check each node belongs to a different group | // Check each node belongs to a different group | ||||
std::set<std::vector<uint8_t>> groups; | std::set<std::vector<uint8_t>> groups; | ||||
ForEachNode([&](const CNode *pnode) { | ForEachNode([&](const CNode *pnode) { | ||||
groups.insert(pnode->addr.GetGroup({})); | groups.insert(pnode->addr.GetGroup({})); | ||||
}); | }); | ||||
BOOST_CHECK_EQUAL(groups.size(), expectedOutboundFullRelayCount + | BOOST_CHECK_EQUAL(groups.size(), expectedOutboundFullRelayCount + | ||||
expectedAvalancheOutboundsCount); | expectedAvalancheOutboundsCount); | ||||
interruptNet(); | |||||
if (threadOpenConnections.joinable()) { | |||||
threadOpenConnections.join(); | |||||
} | |||||
return ret; | return ret; | ||||
} | } | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
class CAddrManSerializationMock : public CAddrMan { | class CAddrManSerializationMock : public CAddrMan { | ||||
public: | public: | ||||
virtual void Serialize(CDataStream &s) const = 0; | virtual void Serialize(CDataStream &s) const = 0; | ||||
▲ Show 20 Lines • Show All 1,016 Lines • Show Last 20 Lines |