mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Don't reference address list after releasing it.
This commit is contained in:
parent
d55f588d61
commit
e4c730c3a5
@ -1,3 +1,8 @@
|
|||||||
|
2003-11-17 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* connect.c (connect_to_host): Don't reference address list after
|
||||||
|
releasing it.
|
||||||
|
|
||||||
2003-11-17 Hrvoje Niksic <hniksic@xemacs.org>
|
2003-11-17 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* main.c (print_help): Fix alignment of FTP options output.
|
* main.c (print_help): Fix alignment of FTP options output.
|
||||||
|
@ -332,12 +332,11 @@ int
|
|||||||
connect_to_host (const char *host, int port)
|
connect_to_host (const char *host, int port)
|
||||||
{
|
{
|
||||||
int i, start, end;
|
int i, start, end;
|
||||||
struct address_list *al;
|
int sock;
|
||||||
int lh_flags = 0;
|
|
||||||
int sock = -1;
|
|
||||||
|
|
||||||
again:
|
struct address_list *al = lookup_host (host, 0);
|
||||||
al = lookup_host (host, lh_flags);
|
|
||||||
|
retry:
|
||||||
if (!al)
|
if (!al)
|
||||||
return E_HOST;
|
return E_HOST;
|
||||||
|
|
||||||
@ -347,31 +346,32 @@ connect_to_host (const char *host, int port)
|
|||||||
const ip_address *ip = address_list_address_at (al, i);
|
const ip_address *ip = address_list_address_at (al, i);
|
||||||
sock = connect_to_ip (ip, port, host);
|
sock = connect_to_ip (ip, port, host);
|
||||||
if (sock >= 0)
|
if (sock >= 0)
|
||||||
|
{
|
||||||
/* Success. */
|
/* Success. */
|
||||||
break;
|
address_list_set_connected (al);
|
||||||
|
address_list_release (al);
|
||||||
address_list_set_faulty (al, i);
|
return sock;
|
||||||
|
}
|
||||||
|
|
||||||
/* The attempt to connect has failed. Continue with the loop
|
/* The attempt to connect has failed. Continue with the loop
|
||||||
and try next address. */
|
and try next address. */
|
||||||
|
|
||||||
|
address_list_set_faulty (al, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Failed to connect to any of the addresses in AL. */
|
||||||
|
|
||||||
|
if (address_list_connected_p (al))
|
||||||
|
{
|
||||||
|
/* We connected to AL before, but cannot do so now. That might
|
||||||
|
indicate that our DNS cache entry for HOST has expired. */
|
||||||
|
address_list_release (al);
|
||||||
|
al = lookup_host (host, LH_REFRESH);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
address_list_release (al);
|
address_list_release (al);
|
||||||
|
|
||||||
if (sock >= 0)
|
return -1;
|
||||||
/* Mark a successful connection to one of the addresses. */
|
|
||||||
address_list_set_connected (al);
|
|
||||||
|
|
||||||
if (sock < 0 && address_list_connected_p (al))
|
|
||||||
{
|
|
||||||
/* 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. */
|
|
||||||
lh_flags |= LH_REFRESH;
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user