If we can't expand our list of entry guards (e.g. because we're

using bridges or we have StrictEntryNodes set), don't mark relays
down when they fail a directory request. Otherwise we're too quick
to mark all our entry points down.


svn:r12755
This commit is contained in:
Roger Dingledine 2007-12-10 17:16:41 +00:00
parent ee6ae92670
commit 52363d23d7
4 changed files with 12 additions and 6 deletions

View file

@ -51,6 +51,10 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
running an obsolete version, it used the string "OLD" to describe running an obsolete version, it used the string "OLD" to describe
it. Yet the "getinfo" interface used the string "OBSOLETE". Now use it. Yet the "getinfo" interface used the string "OBSOLETE". Now use
"OBSOLETE" in both cases. "OBSOLETE" in both cases.
- If we can't expand our list of entry guards (e.g. because we're
using bridges or we have StrictEntryNodes set), don't mark relays
down when they fail a directory request. Otherwise we're too quick
to mark all our entry points down.
o Minor features: o Minor features:
- On USR1, when dmalloc is in use, log the top 10 memory - On USR1, when dmalloc is in use, log the top 10 memory

View file

@ -2430,8 +2430,8 @@ entry_guards_prepend_from_config(void)
/** Return 1 if we're fine adding arbitrary routers out of the /** Return 1 if we're fine adding arbitrary routers out of the
* directory to our entry guard list. Else return 0. */ * directory to our entry guard list. Else return 0. */
static int int
can_grow_entry_list(or_options_t *options) entry_list_can_grow(or_options_t *options)
{ {
if (options->StrictEntryNodes) if (options->StrictEntryNodes)
return 0; return 0;
@ -2469,7 +2469,7 @@ choose_random_entry(cpath_build_state_t *state)
if (should_add_entry_nodes) if (should_add_entry_nodes)
entry_guards_prepend_from_config(); entry_guards_prepend_from_config();
if (can_grow_entry_list(options) && if (entry_list_can_grow(options) &&
(! entry_guards || (! entry_guards ||
smartlist_len(entry_guards) < options->NumEntryGuards)) smartlist_len(entry_guards) < options->NumEntryGuards))
pick_entry_guards(); pick_entry_guards();
@ -2498,7 +2498,7 @@ choose_random_entry(cpath_build_state_t *state)
* using him. * using him.
* (We might get 2 live-but-crummy entry guards, but so be it.) */ * (We might get 2 live-but-crummy entry guards, but so be it.) */
if (smartlist_len(live_entry_guards) < 2) { if (smartlist_len(live_entry_guards) < 2) {
if (can_grow_entry_list(options)) { if (entry_list_can_grow(options)) {
/* still no? try adding a new entry then */ /* still no? try adding a new entry then */
/* XXX if guard doesn't imply fast and stable, then we need /* XXX if guard doesn't imply fast and stable, then we need
* to tell add_an_entry_guard below what we want, or it might * to tell add_an_entry_guard below what we want, or it might
@ -2518,7 +2518,7 @@ choose_random_entry(cpath_build_state_t *state)
need_capacity = 0; need_capacity = 0;
goto retry; goto retry;
} }
if (!r && !can_grow_entry_list(options) && consider_exit_family) { if (!r && !entry_list_can_grow(options) && consider_exit_family) {
/* still no? if we're using bridges or have strictentrynodes /* still no? if we're using bridges or have strictentrynodes
* set, and our chosen exit is in the same family as all our * set, and our chosen exit is in the same family as all our
* bridges/entry guards, then be flexible about families. */ * bridges/entry guards, then be flexible about families. */

View file

@ -500,6 +500,7 @@ connection_dir_request_failed(dir_connection_t *conn)
me->address, me->dir_port); me->address, me->dir_port);
return; /* this was a test fetch. don't retry. */ return; /* this was a test fetch. don't retry. */
} }
if (entry_list_can_grow(get_options()))
router_set_status(conn->identity_digest, 0); /* don't try him again */ router_set_status(conn->identity_digest, 0); /* don't try him again */
if (conn->_base.purpose == DIR_PURPOSE_FETCH_DIR || if (conn->_base.purpose == DIR_PURPOSE_FETCH_DIR ||
conn->_base.purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { conn->_base.purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {

View file

@ -2481,6 +2481,7 @@ void entry_guards_compute_status(void);
int entry_guard_register_connect_status(const char *digest, int succeeded, int entry_guard_register_connect_status(const char *digest, int succeeded,
time_t now); time_t now);
void entry_nodes_should_be_added(void); void entry_nodes_should_be_added(void);
int entry_list_can_grow(or_options_t *options);
routerinfo_t *choose_random_entry(cpath_build_state_t *state); routerinfo_t *choose_random_entry(cpath_build_state_t *state);
int entry_guards_parse_state(or_state_t *state, int set, char **msg); int entry_guards_parse_state(or_state_t *state, int set, char **msg);
void entry_guards_update_state(or_state_t *state); void entry_guards_update_state(or_state_t *state);