diff --git a/rib/auto-prefix-propagator.cpp b/rib/auto-prefix-propagator.cpp index 12344e29..1d872081 100644 --- a/rib/auto-prefix-propagator.cpp +++ b/rib/auto-prefix-propagator.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2015, Regents of the University of California, + * Copyright (c) 2014-2016, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -176,7 +176,8 @@ AutoPrefixPropagator::afterInsertRibEntry(const Name& prefix) auto entryIt = m_propagatedEntries.find(propagateParameters.parameters.getName()); if (entryIt != m_propagatedEntries.end()) { - BOOST_ASSERT(!entryIt->second.isNew()); + // in addition to PROPAGATED and PROPAGATE_FAIL, the state may also be NEW, + // if its propagation was suspended because there was no connectivity to the Hub. NFD_LOG_INFO("prefix has already been propagated: " << propagateParameters.parameters.getName()); return; diff --git a/tests/rib/auto-prefix-propagator.t.cpp b/tests/rib/auto-prefix-propagator.t.cpp index 36998155..24291795 100644 --- a/tests/rib/auto-prefix-propagator.t.cpp +++ b/tests/rib/auto-prefix-propagator.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2015, Regents of the University of California, + * Copyright (c) 2014-2016, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -421,6 +421,23 @@ BOOST_AUTO_TEST_CASE(NoHubConnectivity) BOOST_CHECK(m_requests.empty()); } +BOOST_AUTO_TEST_CASE(ProcessSuspendedEntries) +{ + BOOST_REQUIRE(addIdentity("/test/A")); + + BOOST_REQUIRE(insertEntryToRib("/test/A/app1")); + BOOST_REQUIRE(insertEntryToRib("/test/A/app2")); + BOOST_CHECK(m_requests.empty()); // no propagation because no hub is connected + BOOST_CHECK_EQUAL(m_entries.size(), 1); // /test/A was suspended + + BOOST_REQUIRE(eraseEntryFromRib("/test/A/app2")); + BOOST_CHECK_EQUAL(m_entries.size(), 1); // /test/A was kept for app1 + + // repeat the scenario that leads to BUG 3362. + // ensure there is no improper assertion. + BOOST_REQUIRE(insertEntryToRib("/test/A/app2")); +} + BOOST_AUTO_TEST_CASE(PropagatedEntryExists) { connectToHub();