diff --git a/server_http.hpp b/server_http.hpp index a52e16e..1d5f68a 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -351,7 +351,7 @@ namespace SimpleWeb { std::string address; /// Set to false to avoid binding the socket to an address that is already in use. Defaults to true. bool reuse_address = true; - /// Makes use of RFC 7413 or TCP Fast Open (TFO) + /// Make use of RFC 7413 or TCP Fast Open (TFO) bool fast_open = false; }; /// Set before calling start(). diff --git a/utility.hpp b/utility.hpp index 0e4ee3c..0837f20 100644 --- a/utility.hpp +++ b/utility.hpp @@ -35,24 +35,14 @@ namespace SimpleWeb { { #if defined(__linux__) std::ifstream ifs("/proc/sys/net/ipv4/tcp_fastopen"); - if (!ifs.is_open()) { return false; } + if (!ifs) { return false; } std::string line; if (!std::getline(ifs, line)) { return false; } std::istringstream iss(line); - uint8_t value = 0; + int value = 0; iss >> value; - if (iss.fail()) { return false; } // Should never happen in theory. - auto mode_matches_request = [](const connection_mode mode, const uint8_t value) - { - const auto m = static_cast(mode); - if (mode == connection_mode::client || - mode == connection_mode::server) - { - return (m & value) != 0; - } - return false; - }; - return mode_matches_request(mode, value); + if (!iss) { return false; } // Should never happen in theory. + return (static_cast(mode) & value) != 0; #else (void)mode; return false;