diff options
Diffstat (limited to 'apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h')
-rw-r--r-- | apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h | 36 |
1 files changed, 19 insertions, 17 deletions
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..ae9562a12 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: @@ -23,8 +23,15 @@ extern "C" { #ifndef ASIO_STANDALONE #define ASIO_STANDALONE 1 #endif -#include <asio.hpp> -#include <asio/steady_timer.hpp> + +#ifdef __APPLE__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#endif +#include <hicn/transport/core/asio_wrapper.h> +#ifdef __APPLE__ +#pragma clang diagnostic pop +#endif #include <functional> #include <thread> #include <unordered_map> @@ -45,16 +52,11 @@ using RouteInfoPtr = std::shared_ptr<route_info_t>; class ForwarderInterface { public: - ForwarderInterface(asio::io_service &io_service) + explicit ForwarderInterface(asio::io_service &io_service) : external_ioservice_(io_service), work_(std::make_unique<asio::io_service::work>(internal_ioservice_)), - sock_(nullptr), thread_(std::make_unique<std::thread>( - [this]() { internal_ioservice_.run(); })), - check_routes_timer_(nullptr), - pending_add_route_counter_(0), - route_id_(0), - closed_(false) {} + [this]() { internal_ioservice_.run(); })) {} ~ForwarderInterface(); @@ -88,20 +90,20 @@ class ForwarderInterface { void internalCreateFaceAndRoute(RouteInfoPtr route_info, uint8_t max_try, asio::steady_timer *timer, - SetRouteCallback callback); + const SetRouteCallback &callback); - int tryToCreateFaceAndRoute(route_info_t *route_info); + int tryToCreateFaceAndRoute(const route_info_t *route_info); asio::io_service &external_ioservice_; asio::io_service internal_ioservice_; std::unique_ptr<asio::io_service::work> work_; - hc_sock_t *sock_; + hc_sock_t *sock_ = nullptr; std::unique_ptr<std::thread> thread_; std::unordered_map<uint32_t, RouteInfoPtr> route_status_; - std::unique_ptr<asio::steady_timer> check_routes_timer_; - uint32_t pending_add_route_counter_; - uint32_t route_id_; - bool closed_; + std::unique_ptr<asio::steady_timer> check_routes_timer_ = nullptr; + uint32_t pending_add_route_counter_ = 0; + uint32_t route_id_ = 0; + bool closed_ = false; }; } // namespace transport |