Don't leak the sockets that won't connect

This commit is contained in:
Henrik Rydgård 2023-09-17 17:23:58 +02:00
parent 0421607c00
commit 24bc0b067b

View File

@ -121,6 +121,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
if (connect(sock, possible->ai_addr, (int)possible->ai_addrlen) < 0) {
if (errno != EINPROGRESS) {
ERROR_LOG(HTTP, "connect(%d) call failed (%d: %s)", sock, errno, strerror(errno));
closesocket(sock);
continue;
}
}