mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Network updates.
This commit is contained in:
parent
5921fb2d57
commit
02f90322e8
@ -1,3 +1,11 @@
|
||||
2003-11-10 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* connect.c (connect_to_host): Use that flag to decide whether to
|
||||
re-resolve the host name.
|
||||
|
||||
* host.c (struct address_list): Added a flag that maintains
|
||||
whether the connection worked at some point.
|
||||
|
||||
2003-11-10 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* host.c (lookup_host): Special-case the numeric addresses only in
|
||||
|
@ -356,12 +356,16 @@ connect_to_host (const char *host, int port)
|
||||
}
|
||||
address_list_release (al);
|
||||
|
||||
if (sock < 0 && address_list_cached_p (al))
|
||||
if (sock >= 0)
|
||||
/* Mark a successful connection to one of the addresses. */
|
||||
address_list_set_connected (al);
|
||||
|
||||
if (sock < 0 && address_list_connected_p (al))
|
||||
{
|
||||
/* We were unable to connect to any address in a list we've
|
||||
obtained from cache. There is a possibility that the host is
|
||||
under dynamic DNS and has changed its address. Resolve it
|
||||
again. */
|
||||
/* We are unable to connect to any of HOST's addresses, although
|
||||
we were previously able to connect to HOST. That might
|
||||
indicate that HOST is under dynamic DNS and the addresses
|
||||
we're connecting to have expired. Resolve it again. */
|
||||
forget_host_lookup (host);
|
||||
goto again;
|
||||
}
|
||||
@ -649,6 +653,10 @@ struct extended_info {
|
||||
void *ctx;
|
||||
};
|
||||
|
||||
/* Register the handlers for operations on FD. This is meant
|
||||
primarily for transport layers like SSL that piggyback on sockets,
|
||||
but with their own readers, writers, etc. */
|
||||
|
||||
void
|
||||
register_extended (int fd, xreader_t reader, xwriter_t writer,
|
||||
xpoller_t poller, xcloser_t closer, void *ctx)
|
||||
|
32
src/host.c
32
src/host.c
@ -97,8 +97,9 @@ struct address_list {
|
||||
ip_address *addresses; /* pointer to the string of addresses */
|
||||
|
||||
int faulty; /* number of addresses known not to work. */
|
||||
int from_cache; /* whether this entry was pulled from
|
||||
cache or freshly looked up. */
|
||||
int connected; /* whether we were able to connect to
|
||||
one of the addresses in the list,
|
||||
at least once. */
|
||||
|
||||
int refcount; /* reference count; when it drops to
|
||||
0, the entry is freed. */
|
||||
@ -113,15 +114,6 @@ address_list_get_bounds (const struct address_list *al, int *start, int *end)
|
||||
*end = al->count;
|
||||
}
|
||||
|
||||
/* Return whether this address list entry has been obtained from the
|
||||
cache. */
|
||||
|
||||
int
|
||||
address_list_cached_p (const struct address_list *al)
|
||||
{
|
||||
return al->from_cache;
|
||||
}
|
||||
|
||||
/* Return a pointer to the address at position POS. */
|
||||
|
||||
const ip_address *
|
||||
@ -191,6 +183,23 @@ address_list_set_faulty (struct address_list *al, int index)
|
||||
al->faulty = 0;
|
||||
}
|
||||
|
||||
/* Set the "connected" flag to true. This flag used by connect.c to
|
||||
see if the host perhaps needs to be resolved again. */
|
||||
|
||||
void
|
||||
address_list_set_connected (struct address_list *al)
|
||||
{
|
||||
al->connected = 1;
|
||||
}
|
||||
|
||||
/* Return the value of the "connected" flag. */
|
||||
|
||||
int
|
||||
address_list_connected_p (const struct address_list *al)
|
||||
{
|
||||
return al->connected;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
/**
|
||||
* address_list_from_addrinfo
|
||||
@ -513,7 +522,6 @@ lookup_host (const char *host, int silent)
|
||||
{
|
||||
DEBUGP (("Found %s in host_name_addresses_map (%p)\n", host, al));
|
||||
++al->refcount;
|
||||
al->from_cache = 1;
|
||||
return al;
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +98,12 @@ void forget_host_lookup PARAMS ((const char *));
|
||||
|
||||
void address_list_get_bounds PARAMS ((const struct address_list *,
|
||||
int *, int *));
|
||||
int address_list_cached_p PARAMS ((const struct address_list *));
|
||||
const ip_address *address_list_address_at PARAMS ((const struct address_list *,
|
||||
int));
|
||||
int address_list_find PARAMS ((const struct address_list *, const ip_address *));
|
||||
void address_list_set_faulty PARAMS ((struct address_list *, int));
|
||||
void address_list_set_connected PARAMS ((struct address_list *));
|
||||
int address_list_connected_p PARAMS ((const struct address_list *));
|
||||
void address_list_release PARAMS ((struct address_list *));
|
||||
|
||||
const char *pretty_print_address PARAMS ((const ip_address *));
|
||||
|
Loading…
Reference in New Issue
Block a user