From c46e5df56b67bb8ea7a068d39324c640084ead2b Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Wed, 30 Mar 2022 22:29:28 +0200 Subject: feat: boostrap hicn 22.02 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current patch provides several new features, improvements, bug fixes and also complete rewrite of entire components. - lib The hicn packet parser has been improved with a new packet format fully based on UDP. The TCP header is still temporarily supported but the UDP header will replace completely the new hicn packet format. Improvements have been made to make sure every packet parsing operation is made via this library. The current new header can be used as header between the payload and the UDP header or as trailer in the UDP surplus area to be tested when UDP options will start to be used. - hicn-light The portable packet forwarder has been completely rewritten from scratch with the twofold objective to improve performance and code size but also to drop dependencies such as libparc which is now removed by the current implementation. - hicn control the control library is the agent that is used to program the packet forwarders via their binary API. This component has benefited from significant improvements in terms of interaction model which is now event driven and more robust to failures. - VPP plugin has been updated to support VPP 22.02 - transport Major improvement have been made to the RTC protocol, to the support of IO modules and to the security sub system. Signed manifests are the default data authenticity and integrity framework. Confidentiality can be enabled by sharing the encryption key to the prod/cons layer. The library has been tested with group key based applications such as broadcast/multicast and real-time on-line meetings with trusted server keys or MLS. - testing Unit testing has been introduced using GoogleTest. One third of the code base is covered by unit testing with priority on critical features. Functional testing has also been introduce using Docker, linux bridging and Robot Framework to define test with Less Code techniques to facilitate the extension of the coverage. Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Angelo Mantellini Co-authored-by: Jacques Samain Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Co-authored-by: Giulio Grassi Change-Id: I75d0ef70f86d921e3ef503c99271216ff583c215 Signed-off-by: Luca Muscariello Signed-off-by: Mauro Sardara --- apps/http-proxy/CMakeLists.txt | 66 +++++++++++++--------- .../includes/hicn/http-proxy/CMakeLists.txt | 5 +- .../includes/hicn/http-proxy/forwarder_config.h | 14 ++--- .../includes/hicn/http-proxy/forwarder_interface.h | 2 +- .../hicn/http-proxy/http_1x_message_fast_parser.h | 2 +- .../includes/hicn/http-proxy/http_proxy.h | 8 ++- .../includes/hicn/http-proxy/http_session.h | 9 ++- .../includes/hicn/http-proxy/icn_receiver.h | 5 +- apps/http-proxy/includes/hicn/http-proxy/utils.h | 9 ++- apps/http-proxy/main.cc | 3 +- apps/http-proxy/src/forwarder_interface.cc | 4 +- apps/http-proxy/src/http_1x_message_fast_parser.cc | 2 +- apps/http-proxy/src/http_proxy.cc | 12 ++-- apps/http-proxy/src/http_session.cc | 14 ++--- apps/http-proxy/src/icn_receiver.cc | 12 ++-- 15 files changed, 88 insertions(+), 79 deletions(-) (limited to 'apps/http-proxy') diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt index 66b9c1bab..dbe9bc51c 100644 --- a/apps/http-proxy/CMakeLists.txt +++ b/apps/http-proxy/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021-2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -11,8 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.10 FATAL_ERROR) -set(CMAKE_CXX_STANDARD 14) +############################################################## +# Compiler options +############################################################## +set(COMPILER_OPTIONS + ${DEFAULT_COMPILER_OPTIONS} +) # -Wno-c99-designator issue # @@ -22,20 +26,22 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string ) string (REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string}) if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c99-designator") + list(APPEND COMPILER_OPTIONS + "-Wno-c99-designator" + ) endif() endif() -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${CMAKE_SOURCE_DIR}/cmake/Modules/" -) -if (NOT CMAKE_BUILD_TYPE) - message(STATUS "${PROJECT_NAME}: No build type selected, default to Release") - set(CMAKE_BUILD_TYPE "Release") -endif () +############################################################## +# Includes subdirectory +############################################################## +add_subdirectory(includes/hicn/http-proxy) + +############################################################## +# Source files +############################################################## set(LIB_SOURCE_FILES src/http_session.cc src/http_proxy.cc @@ -48,41 +54,45 @@ set(APP_SOURCE_FILES main.cc ) -add_subdirectory(includes/hicn/http-proxy) -set(LIBHTTP_PROXY hicnhttpproxy) -set(LIBHTTP_PROXY_STATIC ${LIBHTTP_PROXY}.static) - -list(APPEND COMPILER_DEFINITIONS - -DWITH_POLICY -) - +############################################################## +# Libraries to link +############################################################## list(APPEND HTTP_PROXY_LIBRARIES - ${LIBTRANSPORT_LIBRARIES} - ${LIBHICNCTRL_LIBRARIES} - ${LIBHICN_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} + PUBLIC ${LIBTRANSPORT_LIBRARIES} + PUBLIC ${LIBHICNCTRL_LIBRARIES} + PUBLIC ${LIBHICN_LIBRARIES} + PRIVATE ${CMAKE_THREAD_LIBS_INIT} ) + +############################################################## +# Build http proxy library +############################################################## build_library(${LIBHTTP_PROXY} STATIC SOURCES ${LIB_SOURCE_FILES} LINK_LIBRARIES ${HTTP_PROXY_LIBRARIES} DEPENDS ${DEPENDENCIES} INSTALL_HEADERS ${LIBPROXY_TO_INSTALL_HEADER_FILES} - INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBHICNCTRL_INCLUDE_DIRS} ${LIBPROXY_INCLUDE_DIRS} + INCLUDE_DIRS + PUBLIC + $ + $ COMPONENT ${HICN_APPS} LINK_FLAGS ${LINK_FLAGS} - DEFINITIONS ${COMPILER_DEFINITIONS} + COMPILE_OPTIONS ${COMPILER_OPTIONS} ) + +############################################################## +# Build http proxy executable +############################################################## if (NOT DISABLE_EXECUTABLES) build_executable(${HTTP_PROXY} SOURCES ${APP_SOURCE_FILES} LINK_LIBRARIES ${LIBHTTP_PROXY_STATIC} DEPENDS ${LIBHTTP_PROXY_STATIC} COMPONENT ${HICN_APPS} - DEFINITIONS ${COMPILER_DEFINITIONS} LINK_FLAGS ${LINK_FLAGS} ) endif () diff --git a/apps/http-proxy/includes/hicn/http-proxy/CMakeLists.txt b/apps/http-proxy/includes/hicn/http-proxy/CMakeLists.txt index 5cc80a168..18f5704d1 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/CMakeLists.txt +++ b/apps/http-proxy/includes/hicn/http-proxy/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -24,7 +24,7 @@ list(APPEND HEADER_FILES set(HEADER_FILES ${HEADER_FILES} PARENT_SCOPE) set(LIBPROXY_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../.. "" + ${CMAKE_CURRENT_SOURCE_DIR}/../.. CACHE INTERNAL "" FORCE ) @@ -34,4 +34,3 @@ set(LIBPROXY_TO_INSTALL_HEADER_FILES CACHE INTERNAL "" FORCE ) - diff --git a/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h b/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h index e02b9d9a7..935b85e78 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h +++ b/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -60,7 +60,7 @@ class ForwarderConfig { doTryToConnectToForwarder(std::make_error_code(std::errc(0))); } - void doTryToConnectToForwarder(std::error_code ec) { + void doTryToConnectToForwarder(const std::error_code& ec) { if (!ec) { // ec == 0 --> timer expired int ret = forwarder_interface_.connectToForwarder(); @@ -84,7 +84,7 @@ class ForwarderConfig { } } - void doGetMainListener(std::error_code ec) { + void doGetMainListener(const std::error_code& ec) { if (!ec) { // ec == 0 --> timer expired int ret = forwarder_interface_.getMainListenerPort(); @@ -114,7 +114,7 @@ class ForwarderConfig { TRANSPORT_ALWAYS_INLINE bool parseHicnHeader(std::string& header, Callback&& callback) { std::stringstream ss(header); - route_info_t* ret = new route_info_t(); + RouteInfoPtr ret = std::make_shared(); std::string port_string; while (ss.good()) { @@ -174,9 +174,9 @@ class ForwarderConfig { ret->family = AF_INET; std::string _prefix = ret->route_addr; forwarder_interface_.createFaceAndRoute( - RouteInfoPtr(ret), [callback = std::forward(callback), - configured_prefix = std::move(_prefix)]( - uint32_t route_id, bool result) { + std::move(ret), [callback = std::forward(callback), + configured_prefix = std::move(_prefix)]( + uint32_t route_id, bool result) { callback(result, configured_prefix); }); diff --git a/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h b/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h index 54941a4ba..1741aedc6 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h +++ b/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_1x_message_fast_parser.h b/apps/http-proxy/includes/hicn/http-proxy/http_1x_message_fast_parser.h index 7c035c83b..87a5c7d4e 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/http_1x_message_fast_parser.h +++ b/apps/http-proxy/includes/hicn/http-proxy/http_1x_message_fast_parser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h index a4139a620..efb9f850e 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h +++ b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -22,7 +22,9 @@ #include "http_session.h" #include "icn_receiver.h" +#ifndef ASIO_STANDALONE #define ASIO_STANDALONE +#endif #include #include #include @@ -50,9 +52,9 @@ class TcpListener { void doAccept() { #if ((ASIO_VERSION / 100 % 1000) >= 12) acceptor_.async_accept( - [this](std::error_code ec, asio::ip::tcp::socket socket) { + [this](const std::error_code& ec, asio::ip::tcp::socket socket) { #else - acceptor_.async_accept(socket_, [this](std::error_code ec) { + acceptor_.async_accept(socket_, [this](const std::error_code& ec) { auto socket = std::move(socket_); #endif if (!ec) { diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_session.h b/apps/http-proxy/includes/hicn/http-proxy/http_session.h index f4a3dbdee..ee9380a8c 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/http_session.h +++ b/apps/http-proxy/includes/hicn/http-proxy/http_session.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -17,13 +17,12 @@ #include -#include "http_1x_message_fast_parser.h" - -#define ASIO_STANDALONE #include #include #include +#include "http_1x_message_fast_parser.h" + namespace transport { using asio::ip::tcp; @@ -98,7 +97,7 @@ class HTTPSession { bool checkConnected(); private: - void handleRead(std::error_code ec, std::size_t length); + void handleRead(const std::error_code &ec, std::size_t length); void tryReconnection(); void startConnectionTimer(); void handleDeadline(const std::error_code &ec); diff --git a/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h b/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h index 780037665..ab90fab07 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h +++ b/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -13,6 +13,7 @@ * limitations under the License. */ +#include #include #include #include @@ -23,8 +24,6 @@ #include #include #include - -#include //#include "http_session.h" namespace transport { diff --git a/apps/http-proxy/includes/hicn/http-proxy/utils.h b/apps/http-proxy/includes/hicn/http-proxy/utils.h index d87c796d0..0df24dfd9 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/utils.h +++ b/apps/http-proxy/includes/hicn/http-proxy/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -35,14 +35,13 @@ TRANSPORT_ALWAYS_INLINE std::string generatePrefix( str += pos; uint32_t locator_hash = utils::hash::fnv32_buf(str, strlen(str)); + uint16_t* word = (uint16_t*)&locator_hash; std::stringstream stream; stream << first_ipv6_word << ":0"; - for (uint16_t* word = (uint16_t*)&locator_hash; - std::size_t(word) < (std::size_t(&locator_hash) + sizeof(locator_hash)); - word++) { - stream << ":" << std::hex << *word; + for (std::size_t i = 0; i < sizeof(locator_hash) / 2; i++) { + stream << ":" << std::hex << word[i]; } stream << "::"; diff --git a/apps/http-proxy/main.cc b/apps/http-proxy/main.cc index d9c29ecde..9bd97e02e 100644 --- a/apps/http-proxy/main.cc +++ b/apps/http-proxy/main.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -139,7 +139,6 @@ int main(int argc, char** argv) { case 'h': default: return usage(argv[0]); - break; } } diff --git a/apps/http-proxy/src/forwarder_interface.cc b/apps/http-proxy/src/forwarder_interface.cc index c2448de9a..1c034f60f 100644 --- a/apps/http-proxy/src/forwarder_interface.cc +++ b/apps/http-proxy/src/forwarder_interface.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -163,7 +163,7 @@ void ForwarderInterface::internalCreateFaceAndRoute(RouteInfoPtr route_info, max_try--; timer->expires_from_now(std::chrono::milliseconds(500)); timer->async_wait([this, _route_info = std::move(route_info), max_try, - timer, callback](std::error_code ec) { + timer, callback](const std::error_code &ec) { if (ec) return; internalCreateFaceAndRoute(std::move(_route_info), max_try, timer, std::move(callback)); diff --git a/apps/http-proxy/src/http_1x_message_fast_parser.cc b/apps/http-proxy/src/http_1x_message_fast_parser.cc index 4b6b78d55..e97c33161 100644 --- a/apps/http-proxy/src/http_1x_message_fast_parser.cc +++ b/apps/http-proxy/src/http_1x_message_fast_parser.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: diff --git a/apps/http-proxy/src/http_proxy.cc b/apps/http-proxy/src/http_proxy.cc index 2040f7cfa..5abe8780f 100644 --- a/apps/http-proxy/src/http_proxy.cc +++ b/apps/http-proxy/src/http_proxy.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -36,7 +36,7 @@ class HTTPClientConnectionCallback : interface::ConsumerSocket::ReadCallback { : tcp_receiver_(tcp_receiver), thread_(thread), prefix_hash_(tcp_receiver_.prefix_hash_), - consumer_(TransportProtocolAlgorithms::RAAQM, thread_.getIoService()), + consumer_(TransportProtocolAlgorithms::RAAQM, thread_), session_(nullptr), current_size_(0) { consumer_.setSocketOption(ConsumerCallbacksOptions::READ_CALLBACK, this); @@ -69,8 +69,8 @@ class HTTPClientConnectionCallback : interface::ConsumerSocket::ReadCallback { std::uint16_t remote_port = socket.remote_endpoint().port(); TRANSPORT_LOG_INFO << "Client " << remote_address << ":" << remote_port << "disconnected."; - } catch (std::system_error& e) { - // Do nothing + } catch (asio::system_error& e) { + TRANSPORT_LOG_INFO << "Client disconnected."; } consumer_.stop(); @@ -191,7 +191,7 @@ class HTTPClientConnectionCallback : interface::ConsumerSocket::ReadCallback { session_->send(_buffer, []() {}); } - void readError(const std::error_code ec) noexcept { + void readError(const std::error_code& ec) noexcept { TRANSPORT_LOG_ERROR << "Error reading from hicn consumer socket. Closing session."; session_->close(); @@ -265,7 +265,7 @@ TcpReceiver::TcpReceiver(std::uint16_t port, const std::string& prefix, prefix_hash_(generatePrefix(prefix_, ipv6_first_word_)), forwarder_config_( thread_.getIoService(), - [this](std::error_code ec) { + [this](const std::error_code& ec) { if (!ec) { listener_.doAccept(); for (int i = 0; i < 10; i++) { diff --git a/apps/http-proxy/src/http_session.cc b/apps/http-proxy/src/http_session.cc index 84c814cbd..870f188cd 100644 --- a/apps/http-proxy/src/http_session.cc +++ b/apps/http-proxy/src/http_session.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -92,7 +92,7 @@ void HTTPSession::send(const uint8_t *packet, std::size_t len, io_service_.dispatch([this, packet, len, content_sent]() { asio::async_write(socket_, asio::buffer(packet, len), [content_sent = std::move(content_sent)]( - std::error_code ec, std::size_t /*length*/) { + const std::error_code &ec, std::size_t /*length*/) { if (!ec) { content_sent(); } @@ -131,7 +131,7 @@ void HTTPSession::doWrite() { auto &buffer = write_msgs_.front().first; asio::async_write(socket_, asio::buffer(buffer->data(), buffer->length()), - [this](std::error_code ec, std::size_t length) { + [this](const std::error_code &ec, std::size_t length) { if (TRANSPORT_EXPECT_FALSE(!ec)) { write_msgs_.front().second(); write_msgs_.pop_front(); @@ -142,7 +142,7 @@ void HTTPSession::doWrite() { }); } // namespace transport -void HTTPSession::handleRead(std::error_code ec, std::size_t length) { +void HTTPSession::handleRead(const std::error_code &ec, std::size_t length) { if (TRANSPORT_EXPECT_TRUE(!ec)) { content_length_ -= length; const uint8_t *buffer = @@ -207,7 +207,7 @@ void HTTPSession::doReadBody(std::size_t body_size, void HTTPSession::doReadChunkedHeader() { asio::async_read_until( socket_, input_buffer_, "\r\n", - [this](std::error_code ec, std::size_t length) { + [this](const std::error_code &ec, std::size_t length) { if (TRANSPORT_EXPECT_TRUE(!ec)) { const uint8_t *buffer = asio::buffer_cast(input_buffer_.data()); @@ -226,7 +226,7 @@ void HTTPSession::doReadChunkedHeader() { void HTTPSession::doReadHeader() { asio::async_read_until( socket_, input_buffer_, "\r\n\r\n", - [this](std::error_code ec, std::size_t length) { + [this](const std::error_code &ec, std::size_t length) { if (TRANSPORT_EXPECT_TRUE(!ec)) { const uint8_t *buffer = asio::buffer_cast(input_buffer_.data()); @@ -287,7 +287,7 @@ void HTTPSession::tryReconnection() { void HTTPSession::doConnect() { asio::async_connect( socket_, endpoint_iterator_, - [this](std::error_code ec, tcp::resolver::iterator) { + [this](const std::error_code &ec, tcp::resolver::iterator) { if (!ec) { timer_.cancel(); state_ = ConnectorState::CONNECTED; diff --git a/apps/http-proxy/src/icn_receiver.cc b/apps/http-proxy/src/icn_receiver.cc index ea8ac7191..954861e3a 100644 --- a/apps/http-proxy/src/icn_receiver.cc +++ b/apps/http-proxy/src/icn_receiver.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -112,6 +112,7 @@ void AsyncConsumerProducer::doReceive() { }); producer_socket_.connect(); + producer_socket_.start(); } void AsyncConsumerProducer::manageIncomingInterest( @@ -128,9 +129,9 @@ void AsyncConsumerProducer::manageIncomingInterest( if (seg >= _it->second.first) { // TRANSPORT_LOGD( - // "Ignoring interest with name %s for a content object which does not " - // "exist. (Request: %u, max: %u)", - // name.toString().c_str(), (uint32_t)seg, (uint32_t)_it->second.first); + // "Ignoring interest with name %s for a content object which does not + // " "exist. (Request: %u, max: %u)", name.toString().c_str(), + // (uint32_t)seg, (uint32_t)_it->second.first); return; } } @@ -168,7 +169,8 @@ void AsyncConsumerProducer::publishContent(const uint8_t* data, options.getLifetime()); if (TRANSPORT_EXPECT_FALSE(ret != SOCKET_OPTION_SET)) { - TRANSPORT_LOG_WARNING << "Warning: content object lifetime has not been set."; + TRANSPORT_LOG_WARNING + << "Warning: content object lifetime has not been set."; } const interface::Name& name = options.getName(); -- cgit 1.2.3-korg