fix beaconSenders locking

This commit is contained in:
Michael Davidsaver
2021-06-08 09:45:21 -07:00
parent 0f90531615
commit 94f0065a4d
2 changed files with 18 additions and 13 deletions
+11 -6
View File
@@ -447,13 +447,16 @@ void Context::Pvt::onBeacon(const UDPManager::Beacon& msg)
epicsTimeStamp now;
epicsTimeGetCurrent(&now);
auto it = beaconSenders.find(msg.src);
if(it!=beaconSenders.end() && msg.guid==it->second.guid) {
it->second.lastRx = now;
return;
}
{
Guard G(pokeLock);
auto it = beaconSenders.find(msg.src);
if(it!=beaconSenders.end() && msg.guid==it->second.guid) {
it->second.lastRx = now;
return;
}
beaconSenders.emplace(msg.src, BTrack{msg.guid, now});
beaconSenders.emplace(msg.src, BTrack{msg.guid, now});
}
log_debug_printf(io, "%s New server %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x %s\n",
msg.src.tostring().c_str(),
@@ -774,6 +777,8 @@ void Context::Pvt::tickBeaconClean()
epicsTimeStamp now;
epicsTimeGetCurrent(&now);
Guard G(pokeLock);
auto it = beaconSenders.begin();
while(it!=beaconSenders.end()) {
auto cur = it++;