[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] after failing from resolve failed or misc, reset the num fa...
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
connection_edge.c or.h relay.c
Log Message:
after failing from resolve failed or misc, reset the num failures.
Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -d -r1.340 -r1.341
--- connection_edge.c 15 Aug 2005 03:25:39 -0000 1.340
+++ connection_edge.c 15 Aug 2005 03:35:15 -0000 1.341
@@ -652,8 +652,7 @@
int
client_dns_incr_failures(const char *address)
{
- addressmap_entry_t *ent;
- ent = strmap_get(addressmap,address);
+ addressmap_entry_t *ent = strmap_get(addressmap, address);
if (!ent) {
ent = tor_malloc_zero(sizeof(addressmap_entry_t));
ent->expires = time(NULL)+MAX_DNS_ENTRY_AGE;
@@ -665,6 +664,19 @@
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>.
* 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>.
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.644
retrieving revision 1.645
diff -u -d -r1.644 -r1.645
--- or.h 15 Aug 2005 03:25:39 -0000 1.644
+++ or.h 15 Aug 2005 03:35:15 -0000 1.645
@@ -1490,6 +1490,7 @@
int addressmap_already_mapped(const char *address);
void addressmap_register(const char *address, char *new_address, time_t expires);
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);
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);
Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- relay.c 13 Aug 2005 00:31:41 -0000 1.76
+++ relay.c 15 Aug 2005 03:35:15 -0000 1.77
@@ -678,6 +678,8 @@
} else {
log_fn(LOG_NOTICE,"Have tried resolving address '%s' at %d different places. Giving up.",
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;
case END_STREAM_REASON_HIBERNATING: