mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
after failing from resolve failed or misc, reset the num failures.
svn:r4780
This commit is contained in:
parent
f57d062d9c
commit
3728011f36
@ -652,8 +652,7 @@ addressmap_register(const char *address, char *new_address, time_t expires)
|
|||||||
int
|
int
|
||||||
client_dns_incr_failures(const char *address)
|
client_dns_incr_failures(const char *address)
|
||||||
{
|
{
|
||||||
addressmap_entry_t *ent;
|
addressmap_entry_t *ent = strmap_get(addressmap, address);
|
||||||
ent = strmap_get(addressmap,address);
|
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
ent = tor_malloc_zero(sizeof(addressmap_entry_t));
|
ent = tor_malloc_zero(sizeof(addressmap_entry_t));
|
||||||
ent->expires = time(NULL)+MAX_DNS_ENTRY_AGE;
|
ent->expires = time(NULL)+MAX_DNS_ENTRY_AGE;
|
||||||
@ -665,6 +664,19 @@ client_dns_incr_failures(const char *address)
|
|||||||
return ent->num_resolve_failures;
|
return ent->num_resolve_failures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** If <b>address</b> is in the client dns addressmap, reset
|
||||||
|
* the number of resolve failures we have on record for it.
|
||||||
|
* This is used when we fail a stream because it won't resolve:
|
||||||
|
* otherwise future attempts on that address will only try once.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
client_dns_clear_failures(const char *address)
|
||||||
|
{
|
||||||
|
addressmap_entry_t *ent = strmap_get(addressmap, address);
|
||||||
|
if (ent)
|
||||||
|
ent->num_resolve_failures = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** Record the fact that <b>address</b> resolved to <b>val</b>.
|
/** Record the fact that <b>address</b> resolved to <b>val</b>.
|
||||||
* We can now use this in subsequent streams via addressmap_rewrite()
|
* We can now use this in subsequent streams via addressmap_rewrite()
|
||||||
* so we can more correctly choose an exit that will allow <b>address</b>.
|
* so we can more correctly choose an exit that will allow <b>address</b>.
|
||||||
|
@ -1490,6 +1490,7 @@ void addressmap_rewrite(char *address, size_t maxlen);
|
|||||||
int addressmap_already_mapped(const char *address);
|
int addressmap_already_mapped(const char *address);
|
||||||
void addressmap_register(const char *address, char *new_address, time_t expires);
|
void addressmap_register(const char *address, char *new_address, time_t expires);
|
||||||
int client_dns_incr_failures(const char *address);
|
int client_dns_incr_failures(const char *address);
|
||||||
|
void client_dns_clear_failures(const char *address);
|
||||||
void client_dns_set_addressmap(const char *address, uint32_t val, const char *exitname);
|
void client_dns_set_addressmap(const char *address, uint32_t val, const char *exitname);
|
||||||
const char *addressmap_register_virtual_address(int type, char *new_address);
|
const char *addressmap_register_virtual_address(int type, char *new_address);
|
||||||
void addressmap_get_mappings(smartlist_t *sl, time_t min_expires, time_t max_expires);
|
void addressmap_get_mappings(smartlist_t *sl, time_t min_expires, time_t max_expires);
|
||||||
|
@ -678,6 +678,8 @@ connection_edge_process_end_not_open(
|
|||||||
} else {
|
} else {
|
||||||
log_fn(LOG_NOTICE,"Have tried resolving address '%s' at %d different places. Giving up.",
|
log_fn(LOG_NOTICE,"Have tried resolving address '%s' at %d different places. Giving up.",
|
||||||
safe_str(conn->socks_request->address), MAX_RESOLVE_FAILURES);
|
safe_str(conn->socks_request->address), MAX_RESOLVE_FAILURES);
|
||||||
|
/* clear the failures, so it will have a full try next time */
|
||||||
|
client_dns_clear_failures(conn->socks_request->address);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case END_STREAM_REASON_HIBERNATING:
|
case END_STREAM_REASON_HIBERNATING:
|
||||||
|
Loading…
Reference in New Issue
Block a user