Skip to content

Commit

Permalink
Ref. 7288 Remove the change also if the key is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
IkerLuengo committed Jan 22, 2020
1 parent 1ed3d13 commit 0102be9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/cpp/subscriber/SubscriberHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,34 +415,34 @@ bool SubscriberHistory::remove_change_sub(
}

std::lock_guard<RecursiveTimedMutex> guard(*mp_mutex);
if (mp_subImpl->getAttributes().topic.getTopicKind() != NO_KEY)
if (mp_subImpl->getAttributes().topic.getTopicKind() == WITH_KEY)
{
t_m_Inst_Caches::iterator vit;
if (!find_key(change, &vit))
{
return false;
}

bool found = false;
for (auto chit = vit->second.cache_changes.begin(); chit != vit->second.cache_changes.end(); ++chit)
t_m_Inst_Caches::iterator vit;
if (find_key(change, &vit))
{
if ((*chit)->sequenceNumber == change->sequenceNumber && (*chit)->writerGUID == change->writerGUID)
for (auto chit = vit->second.cache_changes.begin(); chit != vit->second.cache_changes.end(); ++chit)
{
vit->second.cache_changes.erase(chit);
found = true;
break;
if ((*chit)->sequenceNumber == change->sequenceNumber && (*chit)->writerGUID == change->writerGUID)
{
vit->second.cache_changes.erase(chit);
found = true;
break;
}
}
}
if (!found)
{
logWarning(SUBSCRIBER, "Change not found, something is wrong");
}
}

if (remove_change(change))
{
m_isHistoryFull = false;
return true;
}

return false;
}

Expand Down

0 comments on commit 0102be9

Please sign in to comment.