Fixing Coding Style
diff --git a/nsync/src/sync-full-state.cc b/nsync/src/sync-full-state.cc
index eb9ca4c..7000606 100644
--- a/nsync/src/sync-full-state.cc
+++ b/nsync/src/sync-full-state.cc
@@ -45,10 +45,10 @@
{
}
-ndn::time::Duration
+ndn::time::system_clock::Duration
FullState::getTimeFromLastUpdate () const
{
- return ndn::time::now() - m_lastUpdated;
+ return ndn::time::system_clock::now() - m_lastUpdated;
}
DigestConstPtr
@@ -81,7 +81,7 @@
boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
{
- m_lastUpdated = ndn::time::now();
+ m_lastUpdated = ndn::time::system_clock::now();
m_digest.reset ();
@@ -109,7 +109,7 @@
bool
FullState::remove (NameInfoConstPtr info)
{
- m_lastUpdated = ndn::time::now();
+ m_lastUpdated = ndn::time::system_clock::now();
m_digest.reset ();
diff --git a/nsync/src/sync-full-state.h b/nsync/src/sync-full-state.h
index 28e0078..028c41e 100644
--- a/nsync/src/sync-full-state.h
+++ b/nsync/src/sync-full-state.h
@@ -51,7 +51,7 @@
*
* This value can be used to randomize reconciliation waiting time in SyncApp
*/
- ndn::time::Duration
+ ndn::time::system_clock::Duration
getTimeFromLastUpdate () const;
/**
@@ -70,7 +70,7 @@
remove (NameInfoConstPtr info);
private:
- ndn::time::Point m_lastUpdated; ///< @brief Time when state was updated last time
+ ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
DigestPtr m_digest;
};
diff --git a/nsync/src/sync-interest-container.h b/nsync/src/sync-interest-container.h
index 742f053..f674d05 100644
--- a/nsync/src/sync-interest-container.h
+++ b/nsync/src/sync-interest-container.h
@@ -47,14 +47,14 @@
Interest (DigestConstPtr digest, const std::string &name, bool unknown=false)
: m_digest (digest)
, m_name (name)
- , m_time (ndn::time::now())
+ , m_time (ndn::time::system_clock::now())
, m_unknown (unknown)
{
}
DigestConstPtr m_digest;
std::string m_name;
- ndn::time::Point m_time;
+ ndn::time::system_clock::TimePoint m_time;
bool m_unknown;
};
@@ -87,7 +87,7 @@
mi::ordered_non_unique<
mi::tag<timed>,
- BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::Point, m_time)
+ BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
>
>
>
diff --git a/nsync/src/sync-interest-table.cc b/nsync/src/sync-interest-table.cc
index a378950..415b641 100644
--- a/nsync/src/sync-interest-table.cc
+++ b/nsync/src/sync-interest-table.cc
@@ -29,7 +29,7 @@
namespace Sync
{
-SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime)
+SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime)
: m_entryLifetime (lifetime)
, m_scheduler(io)
{
@@ -103,7 +103,7 @@
void SyncInterestTable::expireInterests ()
{
uint32_t count = 0;
- ndn::time::Point expireTime = ndn::time::now() - m_entryLifetime;
+ ndn::time::system_clock::TimePoint expireTime = ndn::time::system_clock::now() - m_entryLifetime;
while (m_table.size () > 0)
{
diff --git a/nsync/src/sync-interest-table.h b/nsync/src/sync-interest-table.h
index 9b7c46b..4810c41 100644
--- a/nsync/src/sync-interest-table.h
+++ b/nsync/src/sync-interest-table.h
@@ -42,7 +42,7 @@
class SyncInterestTable
{
public:
- SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime);
+ SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime);
~SyncInterestTable ();
/**
@@ -81,7 +81,7 @@
expireInterests ();
private:
- ndn::time::Duration m_entryLifetime;
+ ndn::time::system_clock::Duration m_entryLifetime;
InterestContainer m_table;
ndn::Scheduler m_scheduler;
diff --git a/nsync/src/sync-logic.cc b/nsync/src/sync-logic.cc
index ec4d63e..c915718 100644
--- a/nsync/src/sync-logic.cc
+++ b/nsync/src/sync-logic.cc
@@ -63,6 +63,10 @@
LogicUpdateCallback onUpdate,
LogicRemoveCallback onRemove)
: m_state (new FullState)
+ , m_unknownDigestStoreTime(10)
+ , m_syncResponseFreshness(1000)
+ , m_syncInterestReexpress(4)
+ , m_defaultRecoveryRetransmitInterval(200)
, m_syncInterestTable (*face->ioService(), time::seconds(m_syncInterestReexpress))
, m_syncPrefix (syncPrefix)
, m_onUpdate (onUpdate)
@@ -424,7 +428,7 @@
// satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
// if state has changed, then it is safe to express a new interest
- time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
EventId eventId = m_scheduler.scheduleEvent (after,
bind (&SyncLogic::sendSyncInterest, this));
@@ -596,7 +600,7 @@
Name interestName = m_syncPrefix;
interestName.append("recovery").append(os.str());
- time::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
m_recoveryRetransmissionInterval <<= 1;
@@ -634,7 +638,7 @@
Data syncData(name);
syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
- syncData.setFreshnessPeriod(m_syncResponseFreshness);
+ syncData.setFreshnessPeriod(time::seconds(m_syncResponseFreshness));
m_keyChain->sign(syncData);
@@ -652,7 +656,7 @@
{
_LOG_DEBUG_ID ("Satisfied our own Interest. Re-expressing (hopefully with a new digest)");
- time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
EventId eventId = m_scheduler.scheduleEvent (after,
bind (&SyncLogic::sendSyncInterest, this));
diff --git a/nsync/src/sync-logic.h b/nsync/src/sync-logic.h
index fc63fca..25d7c5c 100644
--- a/nsync/src/sync-logic.h
+++ b/nsync/src/sync-logic.h
@@ -176,6 +176,12 @@
private:
FullStatePtr m_state;
+
+ int m_unknownDigestStoreTime;
+ int m_syncResponseFreshness;
+ int m_syncInterestReexpress;
+ int m_defaultRecoveryRetransmitInterval;
+
DiffStateContainer m_log;
ndn::Name m_outstandingInterestName;
@@ -197,11 +203,14 @@
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_rangeUniformRandom;
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_reexpressionJitter;
+ /*
static const int m_unknownDigestStoreTime = 10; // seconds
static const int m_syncResponseFreshness = 1000; // MUST BE dividable by 1000!!!
static const int m_syncInterestReexpress = 4; // seconds
static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
+ */
+
uint32_t m_recoveryRetransmissionInterval; // milliseconds
ndn::EventId m_delayedInterestProcessingId;
diff --git a/nsync/src/sync-socket.cc b/nsync/src/sync-socket.cc
index db51ce2..bd4c0e4 100644
--- a/nsync/src/sync-socket.cc
+++ b/nsync/src/sync-socket.cc
@@ -56,7 +56,7 @@
{
shared_ptr<Data> data = make_shared<Data>();
data->setContent(reinterpret_cast<const uint8_t*>(buf), len);
- data->setFreshnessPeriod(1000*freshness);
+ data->setFreshnessPeriod(time::seconds(freshness));
m_ioService->post(bind(&SyncSocket::publishDataInternal, this, data, prefix, session,seq));