aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
diff options
context:
space:
mode:
authorOlivier Roques <olvrqs@gmail.com>2019-11-20 13:53:12 +0000
committerOlivier Roques <olvrqs@gmail.com>2019-11-20 15:07:36 +0000
commit0010de10dcb9183e6c6876fcaaf2283a0ef1ed86 (patch)
treeaab02000bdf77ef5ed5eb4266742aca1a22020d1 /libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
parent1d1c54db773d8b9f81f15295fe6ecea872ce2883 (diff)
[HICN-402] Limit in-flight interests for manifests
Currently, interests for manifests are sent independently of the transport protocol. When receiving a manifest, interests for next manifests are sent until the next window would be full of data segments. But there is no limit on the number of interests for manifests that can be sent. After a while, the interest input buffer in the producer's side is full of them and cannot satisfy the requests quickly enough. This results in a large drop of bandwidth on the consumer side. This patch allows to limit the number of in-flight interests for manifests. Signed-off-by: Olivier Roques <olvrqs@gmail.com> Change-Id: Ic497bd55fd92233e4b47b04635fb9bf75506375e
Diffstat (limited to 'libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc')
-rw-r--r--libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
index 9af6a5c3a..05cabc60d 100644
--- a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
+++ b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
@@ -29,6 +29,7 @@ ManifestIndexManager::ManifestIndexManager(
interface::ConsumerSocket *icn_socket, TransportProtocol *next_interest)
: IncrementalIndexManager(icn_socket),
PacketManager<Interest>(1024),
+ manifests_in_flight_(0),
next_reassembly_segment_(suffix_queue_.end()),
next_to_retrieve_segment_(suffix_queue_.end()),
suffix_manifest_(core::NextSegmentCalculationStrategy::INCREMENTAL, 0),
@@ -86,7 +87,14 @@ bool ManifestIndexManager::onManifest(
// Set the iterators to the beginning of the suffix queue
next_reassembly_segment_ = suffix_queue_.begin();
// Set number of segments in manifests assuming the first one is full
- suffix_manifest_.setNbSegments(std::distance(_it, _end) - 1);
+ suffix_manifest_.setNbSegments(
+ std::distance(manifest->getSuffixList().begin(),
+ manifest->getSuffixList().end()) -
+ 1);
+ suffix_manifest_.setSuffixStrategy(
+ manifest->getNextSegmentCalculationStrategy());
+ } else if (manifests_in_flight_) {
+ manifests_in_flight_--;
}
if (TRANSPORT_EXPECT_FALSE(manifest->isFinalManifest() ||
@@ -110,6 +118,10 @@ bool ManifestIndexManager::onManifest(
// Manifest namespace
Name &name = manifest->getWritableName();
+ if (manifests_in_flight_ >= MAX_MANIFESTS_IN_FLIGHT) {
+ break;
+ }
+
// Send as many manifest as required for filling window.
do {
segment_count += suffix_manifest_.getNbSegments();
@@ -132,8 +144,10 @@ bool ManifestIndexManager::onManifest(
std::placeholders::_1, std::placeholders::_2),
std::bind(&ManifestIndexManager::onManifestTimeout, this,
std::placeholders::_1));
+ manifests_in_flight_++;
} while (segment_count < current_window_size &&
- suffix_manifest_.getSuffix() < final_suffix_);
+ suffix_manifest_.getSuffix() < final_suffix_ &&
+ manifests_in_flight_ < MAX_MANIFESTS_IN_FLIGHT);
break;
}