1
0
Fork 0

clear entries from CID on first page of discovery

This commit is contained in:
Kevin Matz 2021-09-07 09:14:34 -04:00
parent 42368ea01f
commit f3f6b0d35f
1 changed files with 14 additions and 1 deletions

View File

@ -326,6 +326,17 @@ void Receiver::discoveryListHanlder(ACN::PDU::Message<EXTENDED::DISCOVERY::Pdu>
auto data = std::static_pointer_cast<EXTENDED::DISCOVERY::discovery_list_data>
(pdu->data());
// on the first page:
if (header->page == 0)
// wipe all known discoveries from this CID
for (auto disc = discovered.begin(); disc != discovered.end();)
{
if (disc->source == rlpHeader->cid)
disc = discovered.erase(disc);
else
++disc;
}
for (auto& found : data->found)
{
found.source = rlpHeader->cid;
@ -333,8 +344,10 @@ void Receiver::discoveryListHanlder(ACN::PDU::Message<EXTENDED::DISCOVERY::Pdu>
discovered.insert(found);
}
// on the last page:
if (header->page == header->last_page)
for (const auto &cb : discoveryCallbacks_)
// notify that changes are complete
for (const auto& cb : discoveryCallbacks_)
cb();
}