From f9790f48a9f8c91e0c2142d7030b7e0f27c104f0 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Sat, 23 Mar 2019 21:00:43 +0100 Subject: [HICN-6] ATS fixes Change-Id: I1e9a214ead9d4d9bacd98d797371783ad39909f7 Signed-off-by: Mauro Sardara --- apps/http-proxy/main.cc | 5 ++++- apps/http-proxy/src/ATSConnector.cc | 2 +- apps/http-proxy/src/IcnReceiver.cc | 2 +- apps/http-server/http-client/http_client.h | 6 ------ libtransport/src/hicn/transport/core/packet.cc | 8 ++++++++ libtransport/src/hicn/transport/core/packet.h | 2 ++ libtransport/src/hicn/transport/protocols/packet_manager.h | 1 + libtransport/src/hicn/transport/protocols/raaqm.cc | 5 ++++- 8 files changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/http-proxy/main.cc b/apps/http-proxy/main.cc index 179da452b..0dedbd8a7 100644 --- a/apps/http-proxy/main.cc +++ b/apps/http-proxy/main.cc @@ -46,7 +46,7 @@ int main(int argc, char** argv) { break; case 'h': default: - usage(argv[0]); + return usage(argv[0]); break; } } @@ -57,6 +57,9 @@ int main(int argc, char** argv) { prefix = argv[optind]; } + std::cout << "Connecting to " << ip_address << " port " << port + << " Cache size " << cache_size << " Prefix " << prefix + << std::endl; transport::AsyncConsumerProducer proxy(prefix, ip_address, port, cache_size); proxy.run(); diff --git a/apps/http-proxy/src/ATSConnector.cc b/apps/http-proxy/src/ATSConnector.cc index 81f7a776a..2a2f73c3e 100644 --- a/apps/http-proxy/src/ATSConnector.cc +++ b/apps/http-proxy/src/ATSConnector.cc @@ -161,7 +161,7 @@ void ATSConnector::tryReconnection() { is_reconnection_ = true; io_service_.post([this]() { if (socket_.is_open()) { - socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both); + // socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both); socket_.close(); } startConnectionTimer(); diff --git a/apps/http-proxy/src/IcnReceiver.cc b/apps/http-proxy/src/IcnReceiver.cc index ee8ef0823..76e2bd10b 100644 --- a/apps/http-proxy/src/IcnReceiver.cc +++ b/apps/http-proxy/src/IcnReceiver.cc @@ -130,7 +130,7 @@ void AsyncConsumerProducer::manageIncomingInterest( HTTPMessageFastParser::isMpdRequest(payload->data(), payload->length()); chunk_number_map_.emplace(name, 0); - response_name_queue_.emplace(std::move(name), is_mpd ? 500 : 10000); + response_name_queue_.emplace(std::move(name), is_mpd ? 1000 : 10000); connector_.send(payload, [packet = std::move(packet)]() {}); } diff --git a/apps/http-server/http-client/http_client.h b/apps/http-server/http-client/http_client.h index 087a061ab..f36c2fa35 100644 --- a/apps/http-server/http-client/http_client.h +++ b/apps/http-server/http-client/http_client.h @@ -17,13 +17,7 @@ #include -#if defined(HICNET) #include -#elif defined(ICNET) -#include -#else -#error "No ICN tranport library to which link against." -#endif class HTTPClient { public: diff --git a/libtransport/src/hicn/transport/core/packet.cc b/libtransport/src/hicn/transport/core/packet.cc index de8ede421..954266664 100644 --- a/libtransport/src/hicn/transport/core/packet.cc +++ b/libtransport/src/hicn/transport/core/packet.cc @@ -594,6 +594,14 @@ void Packet::separateHeaderPayload() { packet_->append(header_size); } +void Packet::resetPayload() { + if (packet_->isChained()) { + packet_->separateChain(packet_->next(), packet_->prev()); + payload_head_ = nullptr; + updateLength(); + } +} + } // end namespace core } // end namespace transport diff --git a/libtransport/src/hicn/transport/core/packet.h b/libtransport/src/hicn/transport/core/packet.h index 6d8bc7e0f..4ec93205a 100644 --- a/libtransport/src/hicn/transport/core/packet.h +++ b/libtransport/src/hicn/transport/core/packet.h @@ -178,6 +178,8 @@ class Packet : public std::enable_shared_from_this { Packet &setTTL(uint8_t hops); uint8_t getTTL() const; + void resetPayload(); + private: virtual void resetForHash() = 0; void setSignatureSize(std::size_t size_bytes); diff --git a/libtransport/src/hicn/transport/protocols/packet_manager.h b/libtransport/src/hicn/transport/protocols/packet_manager.h index 53486edde..4d4011ecf 100644 --- a/libtransport/src/hicn/transport/protocols/packet_manager.h +++ b/libtransport/src/hicn/transport/protocols/packet_manager.h @@ -53,6 +53,7 @@ class PacketManager { result = interest_pool_.get(); } + result.second->resetPayload(); return std::move(result.second); } diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc index be76f7c23..b10457f40 100644 --- a/libtransport/src/hicn/transport/protocols/raaqm.cc +++ b/libtransport/src/hicn/transport/protocols/raaqm.cc @@ -102,6 +102,9 @@ void RaaqmTransportProtocol::reset() { core::Name *name; socket_->getSocketOption(GeneralTransportOptions::NETWORK_NAME, &name); index_manager_->setFirstSuffix(name->getSuffix()); + std::queue empty; + std::swap(interest_to_retransmit_, empty); + current_window_size_ = 1; // Reset reassembly component BaseReassembly::reset(); @@ -484,7 +487,7 @@ void RaaqmTransportProtocol::sendInterest(std::uint64_t next_suffix) { return; } - interest_retransmissions_[next_suffix & mask] = ~0; + interest_retransmissions_[next_suffix & mask] = 0; interest_timepoints_[next_suffix & mask] = utils::SteadyClock::now(); sendInterest(std::move(interest)); } -- cgit 1.2.3-korg