From ea135be05a73db61decfcbb8cca519da26305721 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 12 Oct 2019 19:09:28 -0700 Subject: [PATCH] Only test TCP ports if the hostname resolves to multiple addresses --- src/PlatformSockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PlatformSockets.c b/src/PlatformSockets.c index b64be6e..810055b 100644 --- a/src/PlatformSockets.c +++ b/src/PlatformSockets.c @@ -301,8 +301,9 @@ int resolveHostName(const char* host, int family, int tcpTestPort, struct sockad } for (currentAddr = res; currentAddr != NULL; currentAddr = currentAddr->ai_next) { - // Use the test port to ensure this address is working - if (tcpTestPort != 0) { + // Use the test port to ensure this address is working if there + // are multiple addresses for this host name + if (tcpTestPort != 0 && res->ai_next != NULL) { SOCKET testSocket = connectTcpSocket((struct sockaddr_storage*)currentAddr->ai_addr, currentAddr->ai_addrlen, tcpTestPort,