From 12fc36890a3e5b68f6d6aba69c9d1ccdb02e11f1 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 24 Dec 2023 10:57:11 +1100 Subject: [PATCH] 3DS: Fix due to last commit that attempting to resolve domains that had IPv6 addresses would crash in Citra --- src/Platform_3DS.c | 6 ++---- src/Server.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Platform_3DS.c b/src/Platform_3DS.c index 878acfb13..478564704 100644 --- a/src/Platform_3DS.c +++ b/src/Platform_3DS.c @@ -297,10 +297,7 @@ cc_result Socket_ParseAddress(const cc_string* address, int port, cc_sockaddr* a *numValidAddrs = 0; struct sockaddr_in* addr4 = (struct sockaddr_in*)addrs[0].data; 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 - // Need to investigate further as I'm probably doing something wrong - // TODO still doesn't work - + // TODO eliminate this path? addr4->sin_family = AF_INET; addr4->sin_port = htons(port); @@ -309,6 +306,7 @@ cc_result Socket_ParseAddress(const cc_string* address, int port, cc_sockaddr* a 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_protocol = IPPROTO_TCP; diff --git a/src/Server.c b/src/Server.c index 7bc2a2713..df9bd4fdd 100644 --- a/src/Server.c +++ b/src/Server.c @@ -214,7 +214,7 @@ static void SPConnection_Init(void) { /*########################################################################################################################* *--------------------------------------------------Multiplayer connection-------------------------------------------------* *#########################################################################################################################*/ -static cc_socket net_socket; +static cc_socket net_socket = -1; static cc_uint8 net_readBuffer[4096 * 5]; static cc_uint8* net_readCurrent;