redesign IfaceMap

Switch to periodic poll on dedicated worker thread
instead of opportunistic poll on use.
This commit is contained in:
Michael Davidsaver
2025-02-20 12:07:12 -08:00
parent 25f5f1dcee
commit a464e9a6eb
9 changed files with 170 additions and 212 deletions
+4 -8
View File
@@ -180,18 +180,14 @@ void test_ifacemap()
{
testDiag("Enter %s", __func__);
auto& ifs = IfaceMap::instance();
auto ifs(IfaceMap::instance());
epicsGuard<epicsMutex> G(ifs.lock); // since we are playing around with the internals...
ifs.refresh(true);
testFalse(ifs.byIndex.empty())<<" found "<<ifs.byIndex.size()<<" interfaces";
testFalse(ifs.current->byIndex.empty())<<" found "<<ifs.current->byIndex.size()<<" interfaces";
bool foundlo = false;
const auto lo(SockAddr::loopback(AF_INET));
for(const auto& pair : ifs.byIndex) {
for(const auto& pair : ifs.current->byIndex) {
auto& iface = pair.second;
testDiag("Interface %u \"%s\"", unsigned(iface.index), iface.name.c_str());
for(const auto& pair : iface.addrs) {
@@ -297,7 +293,7 @@ void test_local_mcast()
{
testDiag("Enter %s", __func__);
IfaceMap ifinfo;
auto ifinfo(IfaceMap::instance());
evsocket A(AF_INET, SOCK_DGRAM, 0, true),
B(AF_INET, SOCK_DGRAM, 0, true);