aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-10-09 14:03:23 +0000
committerGerrit Code Review <gerrit@fd.io>2019-10-09 14:03:23 +0000
commite3d49850d80d6f603180cd5bd5ca0bfc0730f54a (patch)
tree57d93a1bc1f48589fab4f3c078d9699c1824d813 /utils
parent59cc7d7f761b9217b460dfd02520b3dd3a8f49bf (diff)
parent6815fa19a1e914263ca4159617f49925125bff83 (diff)
Merge "[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."
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);