diff --git a/server_http.hpp b/server_http.hpp index 1d5f68a..fca271b 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -401,11 +401,10 @@ namespace SimpleWeb { acceptor = std::unique_ptr(new asio::ip::tcp::acceptor(*io_service)); acceptor->open(endpoint.protocol()); acceptor->set_option(asio::socket_base::reuse_address(config.reuse_address)); - if (config.fast_open && is_tcp_fast_open_supported(connection_mode::server)) - { + if(config.fast_open) { #if defined(__linux__) && defined(TCP_FASTOPEN) const int qlen = 5; // This seems to be the value that is used in other examples. - error_code ec{}; + error_code ec; acceptor->set_option(asio::detail::socket_option::integer(qlen), ec); #endif // End Linux } diff --git a/utility.hpp b/utility.hpp index 0837f20..d98ed41 100644 --- a/utility.hpp +++ b/utility.hpp @@ -8,10 +8,6 @@ #include #include #include -#if defined(__linux__) -#include -#include -#endif #if __cplusplus > 201402L || _MSVC_LANG > 201402L #include @@ -30,25 +26,6 @@ namespace SimpleWeb { #endif namespace SimpleWeb { - enum class connection_mode { client = 1, server = 2 }; - inline bool is_tcp_fast_open_supported(const connection_mode mode) - { -#if defined(__linux__) - std::ifstream ifs("/proc/sys/net/ipv4/tcp_fastopen"); - if (!ifs) { return false; } - std::string line; - if (!std::getline(ifs, line)) { return false; } - std::istringstream iss(line); - int value = 0; - iss >> value; - if (!iss) { return false; } // Should never happen in theory. - return (static_cast(mode) & value) != 0; -#else - (void)mode; - return false; -#endif - } - inline bool case_insensitive_equal(const std::string &str1, const std::string &str2) noexcept { return str1.size() == str2.size() && std::equal(str1.begin(), str1.end(), str2.begin(), [](char a, char b) {