auth dir servers were only modifying a server's is_running field

when they created a network status. so if nobody asked for a
network status, they would never discover that any servers are
is_running, so they could never build a circuit.


svn:r6183
This commit is contained in:
Roger Dingledine
2006-03-18 01:24:04 +00:00
parent cf6ba3e76f
commit 581795f41d
6 changed files with 23 additions and 17 deletions
+6 -5
View File
@@ -1410,19 +1410,20 @@ count_acceptable_routers(smartlist_t *routers)
n = smartlist_len(routers);
for (i=0;i<n;i++) {
r = smartlist_get(routers, i);
// log_fn(LOG_DEBUG,"Contemplating whether router %d (%s) is a new option.",
// i, r->nickname);
// log_debug(LD_CIRC,
// "Contemplating whether router %d (%s) is a new option.",
// i, r->nickname);
if (r->is_running == 0) {
// log_fn(LOG_DEBUG,"Nope, the directory says %d is not running.",i);
// log_debug(LD_CIRC,"Nope, the directory says %d is not running.",i);
goto next_i_loop;
}
if (r->is_verified == 0) {
// log_fn(LOG_DEBUG,"Nope, the directory says %d is not verified.",i);
// log_debug(LD_CIRC,"Nope, the directory says %d is not verified.",i);
/* XXXX009 But unverified routers *are* sometimes acceptable. */
goto next_i_loop;
}
num++;
// log_fn(LOG_DEBUG,"I like %d. num_acceptable_routers now %d.",i, num);
// log_debug(LD_CIRC,"I like %d. num_acceptable_routers now %d.",i, num);
next_i_loop:
; /* C requires an explicit statement after the label */
}
+3 -2
View File
@@ -348,6 +348,7 @@ connection_about_to_close_connection(connection_t *conn)
if (connection_or_nonopen_was_started_here(conn)) {
rep_hist_note_connect_failed(conn->identity_digest, time(NULL));
entry_guard_set_status(conn->identity_digest, 0);
router_set_status(conn->identity_digest, 0);
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
}
} else if (conn->hold_open_until_flushed) {
@@ -1425,11 +1426,11 @@ connection_handle_write(connection_t *conn)
connection_close_immediate(conn);
connection_mark_for_close(conn);
/* it's safe to pass OPs to router_mark_as_down(), since it just
/* it's safe to pass OPs to router_set_status(), since it just
* ignores unrecognized routers
*/
if (conn->type == CONN_TYPE_OR && !get_options()->HttpsProxy)
router_mark_as_down(conn->identity_digest);
router_set_status(conn->identity_digest, 0);
return -1;
} else {
return 0; /* no change, see if next time is better */
+3 -1
View File
@@ -462,8 +462,8 @@ connection_or_connect(uint32_t addr, uint16_t port, const char *id_digest)
* an https proxy, our https proxy is down. Don't blame the
* Tor server. */
if (!options->HttpsProxy) {
router_mark_as_down(conn->identity_digest);
entry_guard_set_status(conn->identity_digest, 0);
router_set_status(conn->identity_digest, 0);
}
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
connection_free(conn);
@@ -637,6 +637,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd)
"but got %s",
conn->address, conn->port, expected, seen);
entry_guard_set_status(conn->identity_digest, 0);
router_set_status(conn->identity_digest, 0);
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
as_advertised = 0;
}
@@ -703,6 +704,7 @@ connection_tls_finish_handshake(connection_t *conn)
/* pending circs get closed in circuit_about_to_close_connection() */
return -1;
}
router_set_status(conn->identity_digest, 1);
}
connection_watch_events(conn, EV_READ);
circuit_n_conn_done(conn, 1); /* send the pending creates, if any. */
+1 -1
View File
@@ -310,7 +310,7 @@ connection_dir_request_failed(connection_t *conn)
{
if (router_digest_is_me(conn->identity_digest))
return; /* this was a test fetch. don't retry. */
router_mark_as_down(conn->identity_digest); /* don't try him again */
router_set_status(conn->identity_digest, 0); /* don't try him again */
if (conn->purpose == DIR_PURPOSE_FETCH_DIR ||
conn->purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
log_info(LD_DIR, "Giving up on directory server at '%s:%d'; retrying",
+1 -1
View File
@@ -2323,7 +2323,7 @@ void routerstatus_free(routerstatus_t *routerstatus);
void networkstatus_free(networkstatus_t *networkstatus);
void routerlist_free_all(void);
routerinfo_t *routerinfo_copy(const routerinfo_t *router);
void router_mark_as_down(const char *digest);
void router_set_status(const char *digest, int up);
void routerlist_remove_old_routers(void);
void networkstatus_list_clean(time_t now);
int router_add_to_routerlist(routerinfo_t *router, const char **msg,
+9 -7
View File
@@ -1409,9 +1409,10 @@ routerlist_reset_warnings(void)
have_warned_about_new_version = 0;
}
/** Mark the router with ID <b>digest</b> as non-running in our routerlist. */
/** Mark the router with ID <b>digest</b> as running or non-running
* in our routerlist. */
void
router_mark_as_down(const char *digest)
router_set_status(const char *digest, int up)
{
routerinfo_t *router;
local_routerstatus_t *status;
@@ -1419,19 +1420,20 @@ router_mark_as_down(const char *digest)
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, d,
if (!memcmp(d->digest, digest, DIGEST_LEN))
d->is_running = 0);
d->is_running = up);
router = router_get_by_digest(digest);
if (router) {
log_debug(LD_DIR,"Marking router '%s' as down.",router->nickname);
if (router_is_me(router) && !we_are_hibernating())
log_debug(LD_DIR,"Marking router '%s' as %s.",
router->nickname, up ? "up" : "down");
if (!up && router_is_me(router) && !we_are_hibernating())
log_warn(LD_NET, "We just marked ourself as down. Are your external "
"addresses reachable?");
router->is_running = 0;
router->is_running = up;
}
status = router_get_combined_status_by_digest(digest);
if (status) {
status->status.is_running = 0;
status->status.is_running = up;
}
}