Skip to content

Commit

Permalink
LDM: replace assertion by an warning when CaObject expiry is out of b…
Browse files Browse the repository at this point in the history
…ounds

Change-Id: I9987e6f68ee5362e1bd7ee5c9b112a809b4a6997
  • Loading branch information
riebl committed Jun 6, 2018
1 parent 6af344d commit e5b2d8f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/artery/application/LocalDynamicMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ void LocalDynamicMap::updateAwareness(const CaObject& obj)
auto tai = mTimer.reconstructMilliseconds(msg->cam.generationDeltaTime);
const omnetpp::SimTime expiry = mTimer.getTimeFor(tai) + lifetime;

AwarenessEntry entry(obj, expiry);
assert(entry.expiry > omnetpp::simTime() && entry.expiry < omnetpp::simTime() + 2.0);
const auto now = omnetpp::simTime();
if (expiry < now || expiry > now + 2 * lifetime) {
EV_STATICCONTEXT
EV_WARN << "Expiry of received CAM is out of bounds";
return;
}

AwarenessEntry entry(obj, expiry);
auto found = mCaMessages.find(msg->header.stationID);
if (found != mCaMessages.end()) {
found->second = std::move(entry);
Expand Down

0 comments on commit e5b2d8f

Please sign in to comment.