fix(hostname): fix handling of non-ASCII hostnames on Windows (#3382)

This commit is contained in:
Cameron Gutman 2024-11-09 14:05:46 -06:00 committed by GitHub
commit fb1f5b5a89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 51 additions and 5 deletions

View file

@ -15,6 +15,7 @@
// lib includes
#include <arpa/inet.h>
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ip/host_name.hpp>
#include <boost/process/v1.hpp>
#include <dlfcn.h>
#include <fcntl.h>
@ -797,6 +798,17 @@ namespace platf {
return std::make_unique<qos_t>(sockfd, reset_options);
}
std::string
get_host_name() {
try {
return boost::asio::ip::host_name();
}
catch (boost::system::system_error &err) {
BOOST_LOG(error) << "Failed to get hostname: "sv << err.what();
return "Sunshine"s;
}
}
namespace source {
enum source_e : std::size_t {
#ifdef SUNSHINE_BUILD_CUDA