Skip to content

Commit

Permalink
communication: pass psync::FullProducer::Options
Browse files Browse the repository at this point in the history
refs #5069

Change-Id: I5986110221a643a9bd459e551f924ca679d8e1fb
  • Loading branch information
yoursunny committed Jan 10, 2024
1 parent b573484 commit 18c6430
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions src/communication/sync-protocol-adapter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2023, The University of Memphis,
* Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
Expand Down Expand Up @@ -42,45 +42,44 @@ SyncProtocolAdapter::SyncProtocolAdapter(ndn::Face& face,
{
switch (m_syncProtocol) {
#ifdef HAVE_CHRONOSYNC
case SyncProtocol::CHRONOSYNC:
NDN_LOG_DEBUG("Using ChronoSync");
m_chronoSyncLogic = std::make_shared<chronosync::Logic>(face,
syncPrefix,
userPrefix,
[this] (auto&&... args) { onChronoSyncUpdate(std::forward<decltype(args)>(args)...); },
chronosync::Logic::DEFAULT_NAME,
chronosync::Logic::DEFAULT_VALIDATOR,
chronosync::Logic::DEFAULT_RESET_TIMER,
chronosync::Logic::DEFAULT_CANCEL_RESET_TIMER,
chronosync::Logic::DEFAULT_RESET_INTEREST_LIFETIME,
syncInterestLifetime,
chronosync::Logic::DEFAULT_SYNC_REPLY_FRESHNESS,
chronosync::Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME,
FIXED_SESSION);
break;
case SyncProtocol::CHRONOSYNC:
NDN_LOG_DEBUG("Using ChronoSync");
m_chronoSyncLogic = std::make_shared<chronosync::Logic>(face,
syncPrefix,
userPrefix,
[this] (auto&&... args) { onChronoSyncUpdate(std::forward<decltype(args)>(args)...); },
chronosync::Logic::DEFAULT_NAME,
chronosync::Logic::DEFAULT_VALIDATOR,
chronosync::Logic::DEFAULT_RESET_TIMER,
chronosync::Logic::DEFAULT_CANCEL_RESET_TIMER,
chronosync::Logic::DEFAULT_RESET_INTEREST_LIFETIME,
syncInterestLifetime,
chronosync::Logic::DEFAULT_SYNC_REPLY_FRESHNESS,
chronosync::Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME,
FIXED_SESSION);
break;
#endif // HAVE_CHRONOSYNC
#ifdef HAVE_PSYNC
case SyncProtocol::PSYNC:
NDN_LOG_DEBUG("Using PSync");
m_psyncLogic = std::make_shared<psync::FullProducer>(face,
keyChain,
80,
syncPrefix,
userPrefix,
[this] (auto&&... args) { onPSyncUpdate(std::forward<decltype(args)>(args)...); },
syncInterestLifetime);
break;
case SyncProtocol::PSYNC: {
NDN_LOG_DEBUG("Using PSync");
psync::FullProducer::Options opts;
opts.onUpdate = [this] (auto&&... args) { onPSyncUpdate(std::forward<decltype(args)>(args)...); };
opts.syncInterestLifetime = syncInterestLifetime;
m_psyncLogic = std::make_shared<psync::FullProducer>(face, keyChain, syncPrefix, opts);
m_psyncLogic->addUserNode(userPrefix);
break;
}
#endif // HAVE_PSYNC
#ifdef HAVE_SVS
case SyncProtocol::SVS:
NDN_LOG_DEBUG("Using SVS");
m_svsCore = std::make_shared<ndn::svs::SVSyncCore>(face,
syncPrefix,
[this] (auto&&... args) { onSvsUpdate(std::forward<decltype(args)>(args)...); });
break;
case SyncProtocol::SVS:
NDN_LOG_DEBUG("Using SVS");
m_svsCore = std::make_shared<ndn::svs::SVSyncCore>(face,
syncPrefix,
[this] (auto&&... args) { onSvsUpdate(std::forward<decltype(args)>(args)...); });
break;
#endif // HAVE_SVS
default:
NDN_CXX_UNREACHABLE;
default:
NDN_CXX_UNREACHABLE;
}
}

Expand Down

0 comments on commit 18c6430

Please sign in to comment.