mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Avoid hanging on MS-Windows when invoked with --connect-timeout
* src/connect.c (connect_to_ip) [WIN32]: Don't call fd_close if the connection timed out, to avoid hanging.
This commit is contained in:
parent
be7d19f478
commit
94d9b68db9
@ -369,7 +369,14 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
|
|||||||
logprintf. */
|
logprintf. */
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
if (sock >= 0)
|
if (sock >= 0)
|
||||||
fd_close (sock);
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
/* If the connection timed out, fd_close will hang in Gnulib's
|
||||||
|
close_fd_maybe_socket, inside the call to WSAEnumNetworkEvents. */
|
||||||
|
if (errno != ETIMEDOUT)
|
||||||
|
#endif
|
||||||
|
fd_close (sock);
|
||||||
|
}
|
||||||
if (print)
|
if (print)
|
||||||
logprintf (LOG_NOTQUIET, _("failed: %s.\n"), strerror (errno));
|
logprintf (LOG_NOTQUIET, _("failed: %s.\n"), strerror (errno));
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user