chunks: respect --retries=-1 in AIMD pipeline
Change-Id: I72a88285500c5083e1a0a1ad32a317e92747d812
Refs: #4409
diff --git a/tools/chunks/catchunks/aimd-rtt-estimator.cpp b/tools/chunks/catchunks/aimd-rtt-estimator.cpp
index 364f693..faa9d83 100644
--- a/tools/chunks/catchunks/aimd-rtt-estimator.cpp
+++ b/tools/chunks/catchunks/aimd-rtt-estimator.cpp
@@ -1,5 +1,6 @@
-/**
- * Copyright (c) 2016, Arizona Board of Regents.
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2016-2017, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -72,7 +73,7 @@
std::ostream&
operator<<(std::ostream& os, const RttEstimator::Options& options)
{
- os << "RttEstimator initial parameters:\n"
+ os << "RTT estimator parameters:\n"
<< "\tAlpha = " << options.alpha << "\n"
<< "\tBeta = " << options.beta << "\n"
<< "\tK = " << options.k << "\n"
diff --git a/tools/chunks/catchunks/options.cpp b/tools/chunks/catchunks/options.cpp
deleted file mode 100644
index 4f5f586..0000000
--- a/tools/chunks/catchunks/options.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2016, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Andrea Tosatto
- * @author Davide Pesavento
- */
-
-#include "options.hpp"
-
-#include <ndn-cxx/interest.hpp>
-
-namespace ndn {
-namespace chunks {
-
-Options::Options()
- : interestLifetime(ndn::DEFAULT_INTEREST_LIFETIME)
- , maxRetriesOnTimeoutOrNack(3)
- , mustBeFresh(false)
- , isVerbose(false)
-{
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/options.hpp b/tools/chunks/catchunks/options.hpp
index 09a914b..4034744 100644
--- a/tools/chunks/catchunks/options.hpp
+++ b/tools/chunks/catchunks/options.hpp
@@ -1,8 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2016, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
+/*
+ * Copyright (c) 2016-2017, Regents of the University of California,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -27,21 +27,18 @@
#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_OPTIONS_HPP
#define NDN_TOOLS_CHUNKS_CATCHUNKS_OPTIONS_HPP
+#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/util/time.hpp>
namespace ndn {
namespace chunks {
-class Options
+struct Options
{
-public:
- Options();
-
-public:
- time::milliseconds interestLifetime;
- int maxRetriesOnTimeoutOrNack;
- bool mustBeFresh;
- bool isVerbose;
+ time::milliseconds interestLifetime = ndn::DEFAULT_INTEREST_LIFETIME;
+ int maxRetriesOnTimeoutOrNack = 3;
+ bool mustBeFresh = false;
+ bool isVerbose = false;
};
} // namespace chunks
diff --git a/tools/chunks/catchunks/pipeline-interests-aimd.cpp b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
index 61ed8f3..a63c9de 100644
--- a/tools/chunks/catchunks/pipeline-interests-aimd.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
@@ -26,6 +26,7 @@
*/
#include "pipeline-interests-aimd.hpp"
+#include "data-fetcher.hpp"
#include <cmath>
@@ -134,7 +135,8 @@
auto ret = m_retxCount.emplace(segNo, 1);
if (ret.second == false) { // not the first retransmission
m_retxCount[segNo] += 1;
- if (m_retxCount[segNo] > m_options.maxRetriesOnTimeoutOrNack) {
+ if (m_options.maxRetriesOnTimeoutOrNack != DataFetcher::MAX_RETRIES_INFINITE &&
+ m_retxCount[segNo] > m_options.maxRetriesOnTimeoutOrNack) {
return handleFail(segNo, "Reached the maximum number of retries (" +
to_string(m_options.maxRetriesOnTimeoutOrNack) +
") while retrieving segment #" + to_string(segNo));
@@ -464,15 +466,16 @@
std::ostream&
operator<<(std::ostream& os, const PipelineInterestsAimdOptions& options)
{
- os << "PipelineInterestsAimd initial parameters:\n"
+ os << "AIMD pipeline parameters:\n"
<< "\tInitial congestion window size = " << options.initCwnd << "\n"
<< "\tInitial slow start threshold = " << options.initSsthresh << "\n"
<< "\tAdditive increase step = " << options.aiStep << "\n"
<< "\tMultiplicative decrease factor = " << options.mdCoef << "\n"
<< "\tRTO check interval = " << options.rtoCheckInterval << "\n"
- << "\tMax retries on timeout or Nack = " << options.maxRetriesOnTimeoutOrNack << "\n"
+ << "\tMax retries on timeout or Nack = " << (options.maxRetriesOnTimeoutOrNack == DataFetcher::MAX_RETRIES_INFINITE ?
+ "infinite" : to_string(options.maxRetriesOnTimeoutOrNack)) << "\n"
<< "\tReaction to congestion marks " << (options.ignoreCongMarks ? "disabled" : "enabled") << "\n"
- << "\tConservative Window Adaptation " << (options.disableCwa ? "disabled" : "enabled") << "\n"
+ << "\tConservative window adaptation " << (options.disableCwa ? "disabled" : "enabled") << "\n"
<< "\tResetting cwnd to " << (options.resetCwndToInit ? "initCwnd" : "ssthresh") << " upon loss event\n";
return os;
}