Finalizing implementation of recovery procedures (when an unknown digest
is received, we remember it. when we generate a new data, send the full
state out)
diff --git a/model/sync-interest-table.cc b/model/sync-interest-table.cc
index 80f8862..a05dba3 100644
--- a/model/sync-interest-table.cc
+++ b/model/sync-interest-table.cc
@@ -58,7 +58,7 @@
}
bool
-SyncInterestTable::insert (DigestConstPtr digest, const string &name)
+SyncInterestTable::insert (DigestConstPtr digest, const string &name, bool unknownState/*=false*/)
{
bool existent = false;
@@ -69,7 +69,7 @@
existent = true;
m_table.erase (it);
}
- m_table.insert (Interest (digest, name));
+ m_table.insert (Interest (digest, name, unknownState));
return existent;
}
diff --git a/model/sync-interest-table.h b/model/sync-interest-table.h
index 2e5451f..824d1f9 100644
--- a/model/sync-interest-table.h
+++ b/model/sync-interest-table.h
@@ -52,7 +52,7 @@
* timestamp
*/
bool
- insert (DigestConstPtr interest, const std::string &name);
+ insert (DigestConstPtr interest, const std::string &name, bool unknownState=false);
/**
* @brief Remove interest by digest (e.g., when it was satisfied)
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 3098b00..e947eda 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -65,8 +65,8 @@
, m_ccnxHandle(new CcnxWrapper())
#ifndef NS3_MODULE
, m_randomGenerator (static_cast<unsigned int> (std::time (0)))
- , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (500,1000))
- , m_reexpressionJitter (m_randomGenerator, uniform_int<> (0,100))
+ , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (200,1000))
+ , m_reexpressionJitter (m_randomGenerator, uniform_int<> (100,500))
#else
, m_rangeUniformRandom (200,1000)
, m_reexpressionJitter (100,500)
@@ -219,7 +219,7 @@
if (*m_state->getDigest() == *digest)
{
_LOG_TRACE ("processSyncInterest (): Same state. Adding to PIT");
- m_syncInterestTable.insert (digest, name);
+ m_syncInterestTable.insert (digest, name, false);
return;
}
@@ -235,7 +235,7 @@
if (!timedProcessing)
{
- bool exists = m_syncInterestTable.insert (digest, name);
+ bool exists = m_syncInterestTable.insert (digest, name, true);
if (exists) // somebody else replied, so restart random-game timer
{
_LOG_DEBUG ("Unknown digest, but somebody may have already replied, so restart our timer");
@@ -260,6 +260,7 @@
SyncLogic::processSyncData (const std::string &name, DigestConstPtr digest, const string &dataBuffer)
{
DiffStatePtr diffLog = make_shared<DiffState> ();
+ bool ownInterestSatisfied = false;
try
{
@@ -267,6 +268,8 @@
m_syncInterestTable.remove (name); // Remove satisfied interest from PIT
+ ownInterestSatisfied = (name == m_outstandingInterestName);
+
DiffState diff;
istringstream ss (dataBuffer);
ss >> diff;
@@ -315,7 +318,8 @@
// don't do anything
}
- if (diffLog != 0 && diffLog->getLeaves ().size () > 0)
+ if ((diffLog != 0 && diffLog->getLeaves ().size () > 0) ||
+ ownInterestSatisfied)
{
// Do it only if everything went fine and state changed