Adding adaptive timer for recovery interest retransmission
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index e947eda..6bd7c42 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -63,13 +63,14 @@
   , m_onUpdate (onUpdate)
   , m_onRemove (onRemove)
   , m_ccnxHandle(new CcnxWrapper())
+  , m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
 #ifndef NS3_MODULE
   , m_randomGenerator (static_cast<unsigned int> (std::time (0)))
   , 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)
+  , m_reexpressionJitter (10,500)
 #endif
 { 
 #ifndef NS3_MODULE
@@ -191,6 +192,7 @@
         }
       else
         {
+          // timer is always restarted when we schedule recovery
           m_scheduler.cancel (REEXPRESSING_RECOVERY_INTEREST);
           processSyncData (name, digest, dataBuffer);
         }
@@ -252,6 +254,8 @@
   else
     {
       _LOG_TRACE ("                                                      (timed processing)");
+      
+      m_recoveryRetransmissionInterval = m_defaultRecoveryRetransmitInterval;
       sendSyncRecoveryInterests (digest);
     }
 }
@@ -475,11 +479,16 @@
   os << m_syncPrefix << "/recovery/" << *digest;
   _LOG_TRACE (">> I " << os.str ());
 
-  // no need for retransmission
-  // m_scheduler.cancel (REEXPRESSING_RECOVERY_INTEREST);
-  // m_scheduler.schedule (TIME_SECONDS_WITH_JITTER(1.0),//TIME_SECONDS_WITH_JITTER (m_syncInterestReexpress),
-  //                       bind (&SyncLogic::sendSyncRecoveryInterests, this, digest),
-  //                       REEXPRESSING_RECOVERY_INTEREST);
+  TimeDuration nextRetransmission = TIME_MILLISECONDS_WITH_JITTER (m_recoveryRetransmissionInterval);
+  m_recoveryRetransmissionInterval <<= 1;
+    
+  m_scheduler.cancel (REEXPRESSING_RECOVERY_INTEREST);
+  if (m_recoveryRetransmissionInterval < 100*1000) // <100 seconds
+    {
+      m_scheduler.schedule (nextRetransmission,
+                            bind (&SyncLogic::sendSyncRecoveryInterests, this, digest),
+                            REEXPRESSING_RECOVERY_INTEREST);
+    }
 
   m_ccnxHandle->sendInterest (os.str (),
                               bind (&SyncLogic::respondSyncData, this, _1, _2));
diff --git a/model/sync-logic.h b/model/sync-logic.h
index 5e38f81..13ae9b7 100644
--- a/model/sync-logic.h
+++ b/model/sync-logic.h
@@ -182,6 +182,9 @@
   static const int m_syncInterestReexpress = 4;
 #endif
 
+  static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
+  uint32_t m_recoveryRetransmissionInterval; // milliseconds
+  
   enum EventLabels
     {
       DELAYED_INTEREST_PROCESSING = 1,