diff options
Diffstat (limited to 'apps/higet')
-rw-r--r-- | apps/higet/CMakeLists.txt | 45 | ||||
-rw-r--r-- | apps/higet/higet.cc | 17 |
2 files changed, 31 insertions, 31 deletions
diff --git a/apps/higet/CMakeLists.txt b/apps/higet/CMakeLists.txt index 8d112d3a3..f4d2d4ec4 100644 --- a/apps/higet/CMakeLists.txt +++ b/apps/higet/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: @@ -11,36 +11,40 @@ # 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) - -project(utils) - -find_package(Threads REQUIRED) - -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules" - "${CMAKE_CURRENT_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 () - +############################################################## +# Source files +############################################################## list(APPEND APPS_SRC higet.cc ) + +############################################################## +# Linker flags +############################################################## if (WIN32) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"LIBCMT\"" ) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"LIBCMT\"" + ) endif() + +############################################################## +# Compiler options +############################################################## +set(COMPILER_OPTIONS + ${DEFAULT_COMPILER_OPTIONS} +) + + +############################################################## +# Build higet +############################################################## if (NOT DISABLE_EXECUTABLES) build_executable(${HIGET} SOURCES ${APPS_SRC} LINK_LIBRARIES + ${LIBHICN_LIBRARIES} ${LIBTRANSPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${WSOCK32_LIBRARY} @@ -49,5 +53,6 @@ if (NOT DISABLE_EXECUTABLES) COMPONENT ${HICN_APPS} DEFINITIONS ${COMPILER_DEFINITIONS} LINK_FLAGS ${LINK_FLAGS} + COMPILE_OPTIONS ${COMPILER_OPTIONS} ) endif () diff --git a/apps/higet/higet.cc b/apps/higet/higet.cc index 9ae869731..d72d7d74f 100644 --- a/apps/higet/higet.cc +++ b/apps/higet/higet.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: @@ -14,23 +14,20 @@ */ #include <hicn/transport/http/client_connection.h> +#include <hicn/transport/utils/chrono_typedefs.h> #include <algorithm> +#include <asio.hpp> #include <fstream> #include <functional> #include <map> +#ifndef ASIO_STANDALONE #define ASIO_STANDALONE +#endif #include <asio.hpp> -#undef ASIO_STANDALONE - #include <thread> -typedef std::chrono::time_point<std::chrono::system_clock> Time; -typedef std::chrono::milliseconds TimeDuration; - -Time t1; - #define DEFAULT_BETA 0.99 #define DEFAULT_GAMMA 0.07 @@ -181,7 +178,7 @@ class ReadBytesCallbackImplementation }); } - void onError(const std::error_code ec) { + void onError(const std::error_code &ec) { io_service_.post([this]() { of_.close(); delete out_; @@ -345,8 +342,6 @@ int main(int argc, char **argv) { connection.setVerifier(verifier); } - t1 = std::chrono::system_clock::now(); - http::ReadBytesCallbackImplementation readBytesCallback(conf.file_name, yetDownloaded); |