mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Use the new function retryable_socket_connect_error instead of the
CONNECT_ERROR macro.
This commit is contained in:
parent
1cfde0c27d
commit
509154dc81
@ -1,3 +1,15 @@
|
||||
2003-11-13 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* http.c (gethttp): Ditto.
|
||||
|
||||
* ftp.c (getftp): Use retryable_socket_connect_error instead of
|
||||
CONNECT_ERROR.
|
||||
|
||||
* wget.h (CONNECT_ERROR): Removed.
|
||||
|
||||
* connect.c (retryable_socket_connect_error): New function instead
|
||||
of unsupported_socket_family_error.
|
||||
|
||||
2003-11-13 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* wget.h (CONNECT_ERROR): Use it.
|
||||
|
@ -574,34 +574,43 @@ socket_ip_address (int sock, ip_address *ip, int endpoint)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return non-zero of the errno code passed to the function is a
|
||||
result of an attempt to create a socket of unsupported family. */
|
||||
/* Return non-zero if the error from the connect code can be
|
||||
considered retryable. Wget normally retries after errors, but the
|
||||
exception are the "unsupported protocol" type errors (possible on
|
||||
IPv4/IPv6 dual family systems) and "connection refused". */
|
||||
|
||||
int
|
||||
unsupported_socket_family_error (int err)
|
||||
retryable_socket_connect_error (int err)
|
||||
{
|
||||
/* Have to guard against some of these values not being defined.
|
||||
Cannot use switch because some of the values might be equal. */
|
||||
Cannot use a switch statement because some of the values might be
|
||||
equal. */
|
||||
if (0
|
||||
#ifdef EAFNOSUPPORT
|
||||
if (err == EAFNOSUPPORT) return 1;
|
||||
|| err == EAFNOSUPPORT
|
||||
#endif
|
||||
#ifdef EPFNOSUPPORT
|
||||
if (err == EPFNOSUPPORT) return 1;
|
||||
|| err == EPFNOSUPPORT
|
||||
#endif
|
||||
#ifdef ESOCKTNOSUPPORT /* no, "sockt" is not a typo! */
|
||||
if (err == ESOCKTNOSUPPORT) return 1;
|
||||
|| err == ESOCKTNOSUPPORT
|
||||
#endif
|
||||
#ifdef EPROTONOSUPPORT
|
||||
if (err == EPROTONOSUPPORT) return 1;
|
||||
|| err == EPROTONOSUPPORT
|
||||
#endif
|
||||
#ifdef ENOPROTOOPT
|
||||
if (err == ENOPROTOOPT) return 1;
|
||||
|| err == ENOPROTOOPT
|
||||
#endif
|
||||
/* Apparently, older versions of Linux used EINVAL instead of
|
||||
EAFNOSUPPORT. */
|
||||
if (err == EINVAL) return 1;
|
||||
|
||||
/* Apparently, older versions of Linux and BSD used EINVAL
|
||||
instead of EAFNOSUPPORT and such. */
|
||||
|| err == EINVAL
|
||||
)
|
||||
return 0;
|
||||
|
||||
if (err == ECONNREFUSED && !opt.retry_connrefused)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SELECT
|
||||
|
@ -56,7 +56,7 @@ enum {
|
||||
};
|
||||
int socket_ip_address PARAMS ((int, ip_address *, int));
|
||||
|
||||
int unsupported_socket_family_error PARAMS ((int));
|
||||
int retryable_socket_connect_error PARAMS ((int));
|
||||
|
||||
/* Flags for select_fd's WAIT_FOR argument. */
|
||||
enum {
|
||||
|
@ -291,7 +291,8 @@ getftp (struct url *u, long *len, long restval, ccon *con)
|
||||
if (csock == E_HOST)
|
||||
return HOSTERR;
|
||||
else if (csock < 0)
|
||||
return CONNECT_ERROR (errno);
|
||||
return (retryable_socket_connect_error (errno)
|
||||
? CONERROR : CONIMPOSSIBLE);
|
||||
|
||||
if (cmd & LEAVE_PENDING)
|
||||
rbuf_initialize (&con->rbuf, csock);
|
||||
@ -693,7 +694,8 @@ Error in server response, closing control connection.\n"));
|
||||
logprintf (LOG_VERBOSE, _("couldn't connect to %s port %hu: %s\n"),
|
||||
pretty_print_address (&passive_addr), passive_port,
|
||||
strerror (save_errno));
|
||||
return CONNECT_ERROR (save_errno);
|
||||
return (retryable_socket_connect_error (save_errno)
|
||||
? CONERROR : CONIMPOSSIBLE);
|
||||
}
|
||||
|
||||
pasv_mode_open = 1; /* Flag to avoid accept port */
|
||||
|
@ -704,7 +704,8 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
|
||||
if (sock == E_HOST)
|
||||
return HOSTERR;
|
||||
else if (sock < 0)
|
||||
return CONNECT_ERROR (errno);
|
||||
return (retryable_socket_connect_error (errno)
|
||||
? CONERROR : CONIMPOSSIBLE);
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (conn->scheme == SCHEME_HTTPS)
|
||||
|
11
src/wget.h
11
src/wget.h
@ -223,15 +223,4 @@ typedef enum
|
||||
SSLERRCERTFILE,SSLERRCERTKEY,SSLERRCTXCREATE
|
||||
} uerr_t;
|
||||
|
||||
/* Whether the connection was unsuccessful or impossible. If the
|
||||
connection is considered impossible (e.g. for unsupported socket
|
||||
family errors), there is no sense in retrying. "Connection
|
||||
refused" is normally not retried, except when opt.retry_connrefused
|
||||
is specified. */
|
||||
|
||||
#define CONNECT_ERROR(err) ((unsupported_socket_family_error (err) \
|
||||
|| ((err) == ECONNREFUSED \
|
||||
&& !opt.retry_connrefused)) \
|
||||
? CONIMPOSSIBLE : CONERROR)
|
||||
|
||||
#endif /* WGET_H */
|
||||
|
Loading…
Reference in New Issue
Block a user