aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-10-09 15:35:08 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-10-09 15:35:08 +0200
commit6815fa19a1e914263ca4159617f49925125bff83 (patch)
tree6ec897a1ecb515e0d90aaafab4468366cdb48969 /utils
parent108c55669102931acc9bd99ca9918379722732b8 (diff)
[HICN-280] Adding set interest lifetime option and deallocating
data packet at consumer side before the content is completely downloaded in order to allow to use an endless hiper producer. Change-Id: I3613b5310a4f8b696818f9453d03682fd61b1f93 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/src/hiperf.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc
index 3e39990a4..ccb22779b 100644
--- a/utils/src/hiperf.cc
+++ b/utils/src/hiperf.cc
@@ -67,7 +67,8 @@ struct ClientConfiguration {
download_size(0),
report_interval_milliseconds_(1000),
rtc_(false),
- test_mode_(false) {}
+ test_mode_(false),
+ interest_lifetime_(1000) {}
Name name;
bool verify;
@@ -82,6 +83,7 @@ struct ClientConfiguration {
TransportProtocolAlgorithms transport_protocol_;
bool rtc_;
bool test_mode_;
+ uint32_t interest_lifetime_;
};
/**
@@ -325,6 +327,7 @@ class HIperfClient {
}
consumer_socket_ = std::make_unique<ConsumerSocket>(transport_protocol);
+ consumer_socket_->setSocketOption(GeneralTransportOptions::INTEREST_LIFETIME, configuration_.interest_lifetime_);
#if defined(DEBUG) && defined(__linux__)
std::shared_ptr<transport::BasePortal> portal;
@@ -509,11 +512,7 @@ class HIperfClient {
void readBufferAvailable(
std::unique_ptr<utils::MemBuf> &&buffer) noexcept override {
- if (client_.configuration_.receive_buffer) {
- client_.configuration_.receive_buffer->prependChain(std::move(buffer));
- } else {
- client_.configuration_.receive_buffer = std::move(buffer);
- }
+ return;
}
size_t maxBufferSize() const override { return read_size; }
@@ -898,6 +897,8 @@ void usage() {
<< std::endl;
std::cerr << "-d <drop_factor_parameter> = RAAQM drop factor parameter"
<< std::endl;
+ std::cerr << "-L\t<interest lifetime>\t\t"
+ << "Set interest lifetime." << std::endl;
std::cerr << "-M = store the content downloaded"
"(default false)"
<< std::endl;
@@ -943,7 +944,7 @@ int main(int argc, char *argv[]) {
int opt;
#ifndef _WIN32
- while ((opt = getopt(argc, argv, "DSCf:b:d:W:RMc:vA:s:rmlk:y:p:hi:xB:It")) !=
+ while ((opt = getopt(argc, argv, "DSCf:b:d:W:RMc:vA:s:rmlk:y:p:hi:xB:ItL:")) !=
-1) {
switch (opt) {
// Common
@@ -956,7 +957,7 @@ int main(int argc, char *argv[]) {
break;
}
#else
- while ((opt = getopt(argc, argv, "SCf:b:d:W:RMc:vA:s:rmlk:y:p:hi:xB:t")) !=
+ while ((opt = getopt(argc, argv, "SCf:b:d:W:RMc:vA:s:rmlk:y:p:hi:xB:tL:")) !=
-1) {
switch (opt) {
#endif
@@ -1021,6 +1022,11 @@ int main(int argc, char *argv[]) {
options = 1;
break;
}
+ case 'L': {
+ client_configuration.interest_lifetime_ = std::stoul(optarg);
+ options = 1;
+ break;
+ }
// Server specific
case 'A': {
server_configuration.download_size = std::stoul(optarg);