Commit 7b06f736 authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Merge branch 'ipv4_fallback' of https://gitlab.com/quobert/Simple-Web-Server

parents 8ee71cdd 69d6a420
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -401,7 +401,16 @@ namespace SimpleWeb {

      if(!acceptor)
        acceptor = std::unique_ptr<asio::ip::tcp::acceptor>(new asio::ip::tcp::acceptor(*io_service));
      try {
        acceptor->open(endpoint.protocol());
      } catch (const system_error& error) {
        if(error.code() == asio::error::address_family_not_supported && config.address.empty()) {
          endpoint = asio::ip::tcp::endpoint(asio::ip::tcp::v4(), config.port);
          acceptor->open(endpoint.protocol());
        } else {
          throw;
        }
      }
      acceptor->set_option(asio::socket_base::reuse_address(config.reuse_address));
      if(config.fast_open) {
#if defined(__linux__) && defined(TCP_FASTOPEN)