diff options
| author | 2021-08-12 22:15:48 +0200 | |
|---|---|---|
| committer | 2021-08-12 22:15:48 +0200 | |
| commit | 21743daf38f19160baa2da0e939a4e945dd57228 (patch) | |
| tree | 99b45f0de20ddfde64a25d9cb42d0f328c0858fc /src/core | |
| parent | configuration: add option to select network interface (diff) | |
| download | yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.gz yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.xz yuzu-21743daf38f19160baa2da0e939a4e945dd57228.zip | |
network: correct formatting in network.cpp and network_interface.cpp
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/network/network.cpp | 6 | ||||
| -rw-r--r-- | src/core/network/network_interface.cpp | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp index 67ecf57bd..9a4ac7e83 100644 --- a/src/core/network/network.cpp +++ b/src/core/network/network.cpp | |||
| @@ -13,13 +13,13 @@ | |||
| 13 | #include <winsock2.h> | 13 | #include <winsock2.h> |
| 14 | #include <ws2tcpip.h> | 14 | #include <ws2tcpip.h> |
| 15 | #elif YUZU_UNIX | 15 | #elif YUZU_UNIX |
| 16 | #include <arpa/inet.h> | ||
| 16 | #include <errno.h> | 17 | #include <errno.h> |
| 17 | #include <fcntl.h> | 18 | #include <fcntl.h> |
| 18 | #include <netdb.h> | 19 | #include <netdb.h> |
| 19 | #include <netinet/in.h> | 20 | #include <netinet/in.h> |
| 20 | #include <poll.h> | 21 | #include <poll.h> |
| 21 | #include <sys/socket.h> | 22 | #include <sys/socket.h> |
| 22 | #include <arpa/inet.h> | ||
| 23 | #include <unistd.h> | 23 | #include <unistd.h> |
| 24 | #else | 24 | #else |
| 25 | #error "Unimplemented platform" | 25 | #error "Unimplemented platform" |
| @@ -363,8 +363,8 @@ NetworkInstance::~NetworkInstance() { | |||
| 363 | std::optional<IPv4Address> GetHostIPv4Address() { | 363 | std::optional<IPv4Address> GetHostIPv4Address() { |
| 364 | const std::string& selected_network_interface = Settings::values.network_interface.GetValue(); | 364 | const std::string& selected_network_interface = Settings::values.network_interface.GetValue(); |
| 365 | const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); | 365 | const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); |
| 366 | ASSERT_MSG(network_interfaces.size() > 0, "GetAvailableNetworkInterfaces returned no interfaces"); | 366 | ASSERT_MSG(network_interfaces.size() > 0, |
| 367 | 367 | "GetAvailableNetworkInterfaces returned no interfaces"); | |
| 368 | 368 | ||
| 369 | const auto res = std::ranges::find_if(network_interfaces, | 369 | const auto res = std::ranges::find_if(network_interfaces, |
| 370 | [&selected_network_interface](const auto& interface) { | 370 | [&selected_network_interface](const auto& interface) { |
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp index bba4c8b26..2b53682ea 100644 --- a/src/core/network/network_interface.cpp +++ b/src/core/network/network_interface.cpp | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | #ifdef _WIN32 | 12 | #ifdef _WIN32 |
| 13 | #include <iphlpapi.h> | 13 | #include <iphlpapi.h> |
| 14 | #else | 14 | #else |
| 15 | #include <cerrno> | ||
| 15 | #include <ifaddrs.h> | 16 | #include <ifaddrs.h> |
| 16 | #include <net/if.h> | 17 | #include <net/if.h> |
| 17 | #include <cerrno> | ||
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | namespace Network { | 20 | namespace Network { |
| @@ -61,8 +61,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { | |||
| 61 | 61 | ||
| 62 | result.push_back(NetworkInterface{ | 62 | result.push_back(NetworkInterface{ |
| 63 | .name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})}, | 63 | .name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})}, |
| 64 | .ip_address{ip_addr} | 64 | .ip_address{ip_addr}}); |
| 65 | }); | ||
| 66 | } | 65 | } |
| 67 | } else { | 66 | } else { |
| 68 | LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses"); | 67 | LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses"); |
| @@ -99,8 +98,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { | |||
| 99 | 98 | ||
| 100 | result.push_back(NetworkInterface{ | 99 | result.push_back(NetworkInterface{ |
| 101 | .name{ifa->ifa_name}, | 100 | .name{ifa->ifa_name}, |
| 102 | .ip_address{std::bit_cast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr} | 101 | .ip_address{std::bit_cast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}}); |
| 103 | }); | ||
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | freeifaddrs(ifaddr); | 104 | freeifaddrs(ifaddr); |