3DS: Fix due to last commit that attempting to resolve domains that had IPv6 addresses would crash in Citra

This commit is contained in:
UnknownShadow200 2023-12-24 10:57:11 +11:00
parent 4e05f3626f
commit 12fc36890a
2 changed files with 3 additions and 5 deletions

View File

@ -297,10 +297,7 @@ cc_result Socket_ParseAddress(const cc_string* address, int port, cc_sockaddr* a
*numValidAddrs = 0; *numValidAddrs = 0;
struct sockaddr_in* addr4 = (struct sockaddr_in*)addrs[0].data; struct sockaddr_in* addr4 = (struct sockaddr_in*)addrs[0].data;
if (inet_aton(str, &addr4->sin_addr) > 0) { if (inet_aton(str, &addr4->sin_addr) > 0) {
// TODO have to have this path, otherwise Citra crashes when crashing connecting to server if you always use getaddrinfo instead // TODO eliminate this path?
// Need to investigate further as I'm probably doing something wrong
// TODO still doesn't work
addr4->sin_family = AF_INET; addr4->sin_family = AF_INET;
addr4->sin_port = htons(port); addr4->sin_port = htons(port);
@ -309,6 +306,7 @@ cc_result Socket_ParseAddress(const cc_string* address, int port, cc_sockaddr* a
return 0; return 0;
} }
hints.ai_family = AF_INET; // TODO: you need this, otherwise resolving dl.dropboxusercontent.com crashes in Citra. probably something to do with IPv6 addresses
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;

View File

@ -214,7 +214,7 @@ static void SPConnection_Init(void) {
/*########################################################################################################################* /*########################################################################################################################*
*--------------------------------------------------Multiplayer connection-------------------------------------------------* *--------------------------------------------------Multiplayer connection-------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static cc_socket net_socket; static cc_socket net_socket = -1;
static cc_uint8 net_readBuffer[4096 * 5]; static cc_uint8 net_readBuffer[4096 * 5];
static cc_uint8* net_readCurrent; static cc_uint8* net_readCurrent;