diff options
Diffstat (limited to 'utils/src/hiperf.cc')
-rw-r--r-- | utils/src/hiperf.cc | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc index e037e1309..eabd12c86 100644 --- a/utils/src/hiperf.cc +++ b/utils/src/hiperf.cc @@ -69,10 +69,10 @@ struct ClientConfiguration { beta(-1.f), drop_factor(-1.f), window(-1), - virtual_download(true), producer_certificate(""), passphrase(""), receive_buffer(nullptr), + receive_buffer_size_(128 * 1024), download_size(0), report_interval_milliseconds_(1000), transport_protocol_(CBR), @@ -90,10 +90,10 @@ struct ClientConfiguration { double beta; double drop_factor; double window; - bool virtual_download; std::string producer_certificate; std::string passphrase; std::shared_ptr<utils::MemBuf> receive_buffer; + std::size_t receive_buffer_size_; std::size_t download_size; std::uint32_t report_interval_milliseconds_; TransportProtocolAlgorithms transport_protocol_; @@ -423,12 +423,6 @@ class HIperfClient { } } - if (consumer_socket_->setSocketOption(OtherOptions::VIRTUAL_DOWNLOAD, - configuration_.virtual_download) == - SOCKET_OPTION_NOT_SET) { - return ERROR_SETUP; - } - if (configuration_.verify) { std::shared_ptr<utils::Verifier> verifier = std::make_shared<utils::Verifier>(); @@ -570,22 +564,29 @@ class HIperfClient { }; class Callback : public ConsumerSocket::ReadCallback { - static constexpr std::size_t read_size = 16 * 1024; - public: - Callback(HIperfClient &hiperf_client) : client_(hiperf_client) {} + Callback(HIperfClient &hiperf_client) : client_(hiperf_client) { + client_.configuration_.receive_buffer = + utils::MemBuf::create(client_.configuration_.receive_buffer_size_); + } - bool isBufferMovable() noexcept override { return true; } + bool isBufferMovable() noexcept override { return false; } void getReadBuffer(uint8_t **application_buffer, - size_t *max_length) override {} + size_t *max_length) override { + *application_buffer = + client_.configuration_.receive_buffer->writableData(); + *max_length = client_.configuration_.receive_buffer_size_; + } void readDataAvailable(std::size_t length) noexcept override {} void readBufferAvailable( std::unique_ptr<utils::MemBuf> &&buffer) noexcept override {} - size_t maxBufferSize() const override { return read_size; } + size_t maxBufferSize() const override { + return client_.configuration_.receive_buffer_size_; + } void readError(const std::error_code ec) noexcept override { std::cerr << "Error " << ec.message() << " while reading from socket" @@ -742,6 +743,7 @@ class HIperfServer { } void virtualProcessInterest(ProducerSocket &p, const Interest &interest) { + // std::cout << "Received interest " << interest.getName() << std::endl; content_objects_[content_objects_index_ & mask_]->setName( interest.getName()); producer_socket_->produce( @@ -1149,8 +1151,10 @@ void usage() { << std::endl; std::cerr << "-L\t<interest lifetime>\t\t" << "Set interest lifetime." << std::endl; - std::cerr << "-M\t<Download for real>\t\t" - << "Store the content downloaded." << std::endl; + std::cerr << "-M\t<input_buffer_size>\t\t" + << "Size of consumer input buffer. If 0, reassembly of packets " + "will be disabled." + << std::endl; std::cerr << "-W\t<window_size>\t\t\t" << "Use a fixed congestion window " "for retrieving the data." @@ -1204,7 +1208,7 @@ int main(int argc, char *argv[]) { int opt; #ifndef _WIN32 while ((opt = getopt(argc, argv, - "DSCf:b:d:W:RMc:vA:s:rmlK:k:y:p:hi:xE:P:B:ItL:")) != + "DSCf:b:d:W:RM:c:vA:s:rmlK:k:y:p:hi:xE:P:B:ItL:")) != -1) { switch (opt) { // Common @@ -1218,7 +1222,7 @@ int main(int argc, char *argv[]) { } #else while ((opt = getopt(argc, argv, - "SCf:b:d:W:RMc:vA:s:rmlK:k:y:p:hi:xB:E:P:tL:")) != -1) { + "SCf:b:d:W:RM:c:vA:s:rmlK:k:y:p:hi:xB:E:P:tL:")) != -1) { switch (opt) { #endif case 'f': { @@ -1265,7 +1269,7 @@ int main(int argc, char *argv[]) { break; } case 'M': { - client_configuration.virtual_download = false; + client_configuration.receive_buffer_size_ = std::stoull(optarg); options = 1; break; } |