Merge pull request #11739 from SimpleTease/ipv6

netplay: attempt ipv4 when ipv6 failure
This commit is contained in:
Autechre 2020-12-23 15:53:22 +01:00 committed by GitHub
commit 08b9c40728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,6 +134,7 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
if (getaddrinfo_retro(server, port_buf, &hints, &res) != 0)
{
#ifdef HAVE_INET6
try_wildcard:
if (!server)
{
/* Didn't work with IPv6, try wildcard */
@ -213,7 +214,13 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
freeaddrinfo_retro(res);
if (!ret)
{
#ifdef HAVE_INET6
if (!direct_host && (hints.ai_family == AF_INET6))
goto try_wildcard;
#endif
RARCH_ERR("Failed to set up netplay sockets.\n");
}
return ret;
}