netplay: attempt ipv4 when ipv6 failure

This commit is contained in:
SimpleTease 2020-12-23 04:17:05 +00:00 committed by GitHub
parent 7d313647ae
commit 1633652a63
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;
}