From 31f349f4c4457344efcff20ccadfed53042891b1 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Wed, 15 May 2019 14:31:17 +0200 Subject: [HICN-196] Add mtu to command line parameters. Change-Id: Ib6932c23408630be1ca98146d22ac494ad5e5077 Signed-off-by: Mauro Sardara --- apps/http-proxy/src/ATSConnector.cc | 3 ++- apps/http-proxy/src/IcnReceiver.cc | 11 ++++++++++- apps/http-proxy/src/IcnReceiver.h | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'apps/http-proxy/src') diff --git a/apps/http-proxy/src/ATSConnector.cc b/apps/http-proxy/src/ATSConnector.cc index 287907347..a1c8c9708 100644 --- a/apps/http-proxy/src/ATSConnector.cc +++ b/apps/http-proxy/src/ATSConnector.cc @@ -193,7 +193,8 @@ void ATSConnector::doConnect() { } } else { - TRANSPORT_LOGE("Impossible to reconnect."); + TRANSPORT_LOGE("Impossible to reconnect: %s", + ec.message().c_str()); close(); } }); diff --git a/apps/http-proxy/src/IcnReceiver.cc b/apps/http-proxy/src/IcnReceiver.cc index 4ad616168..fc6837a2c 100644 --- a/apps/http-proxy/src/IcnReceiver.cc +++ b/apps/http-proxy/src/IcnReceiver.cc @@ -55,12 +55,14 @@ core::Prefix generatePrefix(const std::string& prefix_url) { AsyncConsumerProducer::AsyncConsumerProducer(const std::string& prefix, std::string& ip_address, std::string& port, - std::string& cache_size) + std::string& cache_size, + std::string& mtu) : prefix_(generatePrefix(prefix)), producer_socket_(), ip_address_(ip_address), port_(port), cache_size_(std::stoul(cache_size)), + mtu_(std::stoul(mtu)), request_counter_(0), signals_(io_service_, SIGINT, SIGQUIT), connector_(io_service_, ip_address_, port_, @@ -78,6 +80,13 @@ AsyncConsumerProducer::AsyncConsumerProducer(const std::string& prefix, TRANSPORT_LOGD("Warning: output buffer size has not been set."); } + ret = producer_socket_.setSocketOption( + interface::GeneralTransportOptions::DATA_PACKET_SIZE, mtu_); + + if (ret != SOCKET_OPTION_SET) { + TRANSPORT_LOGD("Warning: mtu has not been set."); + } + producer_socket_.registerPrefix(prefix_); // Let the main thread to catch SIGINT and SIGQUIT diff --git a/apps/http-proxy/src/IcnReceiver.h b/apps/http-proxy/src/IcnReceiver.h index 7d5c5e4c8..61ca4333a 100644 --- a/apps/http-proxy/src/IcnReceiver.h +++ b/apps/http-proxy/src/IcnReceiver.h @@ -31,7 +31,7 @@ class AsyncConsumerProducer { public: explicit AsyncConsumerProducer(const std::string& prefix, std::string& ip_address, std::string& port, - std::string& cache_size); + std::string& cache_size, std::string& mtu); void start(); @@ -55,6 +55,7 @@ class AsyncConsumerProducer { std::string ip_address_; std::string port_; uint32_t cache_size_; + uint32_t mtu_; uint64_t request_counter_; asio::signal_set signals_; -- cgit 1.2.3-korg