src+tools: use segment fetcher start

jenkins: re-compile ChronoSync on ndn-cxx change

refs: #4464

Change-Id: Ia627e00b8f13bad0068e213a6019f62a84cad41a
diff --git a/.jenkins.d/02-chronosync.sh b/.jenkins.d/02-chronosync.sh
index 82145f6..b798776 100755
--- a/.jenkins.d/02-chronosync.sh
+++ b/.jenkins.d/02-chronosync.sh
@@ -18,6 +18,13 @@
     fi
 fi
 
+NDN_CXX=$(ndnsec version)
+OLD_NDN_CXX=$(cat ndn_cxx_chrono.txt || :)
+if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
+    echo "$NDN_CXX" > ndn_cxx_chrono.txt
+    INSTALLED_VERSION=NONE
+fi
+
 if [[ -z $INSTALLED_VERSION ]]; then
     INSTALLED_VERSION=$(git -C ChronoSync rev-parse HEAD 2>/dev/null || echo NONE)
 fi
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index ce77683..eae4a43 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1002,12 +1002,12 @@
   interest.setInterestLifetime(m_nlsr.getConfParameter().getLsaInterestLifetime());
 
   NLSR_LOG_DEBUG("Fetching Data for LSA: " << interestName << " Seq number: " << seqNo);
-  shared_ptr<ndn::util::SegmentFetcher> fetcher =
-    ndn::util::SegmentFetcher::fetch(m_nlsr.getNlsrFace(), interest,
-                                     m_nlsr.getValidator(),
-                                     std::bind(&Lsdb::afterFetchLsa, this, _1, interestName),
-                                     std::bind(&Lsdb::onFetchLsaError, this, _1, _2, interestName,
-                                               timeoutCount, deadline, lsaName, seqNo));
+  auto fetcher = ndn::util::SegmentFetcher::start(m_nlsr.getNlsrFace(),
+                                                  interest, m_nlsr.getValidator());
+
+  fetcher->onComplete.connect(std::bind(&Lsdb::afterFetchLsa, this, _1, interestName));
+  fetcher->onError.connect(std::bind(&Lsdb::onFetchLsaError, this, _1, _2, interestName,
+                                     timeoutCount, deadline, lsaName, seqNo));
 
   m_lsaStorage.connectToFetcher(*fetcher);
   m_nlsr.connectToFetcher(*fetcher);
diff --git a/tools/nlsrc.cpp b/tools/nlsrc.cpp
index 3db6215..1228bc8 100644
--- a/tools/nlsrc.cpp
+++ b/tools/nlsrc.cpp
@@ -256,12 +256,9 @@
 
   ndn::Interest interest(command);
 
-  ndn::util::SegmentFetcher::fetch(m_face,
-                                   interest,
-                                   m_validator,
-                                   std::bind(&Nlsrc::onFetchSuccess<T>,
-                                             this, _1, recordLsa),
-                                   std::bind(&Nlsrc::onTimeout, this, _1, _2));
+  auto fetcher = ndn::util::SegmentFetcher::start(m_face, interest, m_validator);
+  fetcher->onComplete.connect(std::bind(&Nlsrc::onFetchSuccess<T>, this, _1, recordLsa));
+  fetcher->onError.connect(std::bind(&Nlsrc::onTimeout, this, _1, _2));
 }
 
 template <class T>
@@ -272,12 +269,9 @@
 
   ndn::Interest interest(command);
 
-  ndn::util::SegmentFetcher::fetch(m_face,
-                                   interest,
-                                   m_validator,
-                                   std::bind(&Nlsrc::onFetchSuccess<T>,
-                                             this, _1, recordDataset),
-                                   std::bind(&Nlsrc::onTimeout, this, _1, _2));
+  auto fetcher = ndn::util::SegmentFetcher::start(m_face, interest, m_validator);
+  fetcher->onComplete.connect(std::bind(&Nlsrc::onFetchSuccess<T>, this, _1, recordDataset));
+  fetcher->onError.connect(std::bind(&Nlsrc::onTimeout, this, _1, _2));
 }
 
 template <class T>