From 538655cd806b46519512e10ef097790afa1b36b9 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Mon, 12 Jul 2004 18:19:55 +0000 Subject: if connecting to an OR fails immediately, mark it as down svn:r2029 --- src/or/connection.c | 4 +++- src/or/connection_or.c | 1 + src/or/routerlist.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/or') diff --git a/src/or/connection.c b/src/or/connection.c index 90c8197c4..578466bae 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -829,7 +829,9 @@ int connection_handle_write(connection_t *conn) { log_fn(LOG_DEBUG,"in-progress connect failed. Removing."); connection_close_immediate(conn); connection_mark_for_close(conn); - /* Previously we tested conn->nickname; is this right? */ + /* it's safe to pass OPs to router_mark_as_down(), since it just + * ignores unrecognized routers + */ if (conn->type == CONN_TYPE_OR) router_mark_as_down(conn->identity_digest); return -1; diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 667a82d92..87e2f9df2 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -177,6 +177,7 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port, switch(connection_connect(conn, conn->address, addr, port)) { case -1: + router_mark_as_down(conn->identity_digest); connection_free(conn); return NULL; case 0: diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 1bd21e441..7874b1075 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -354,7 +354,7 @@ void routerlist_free(routerlist_t *rl) tor_free(rl); } -/** Mark the router named nickname as non-running in our routerlist. */ +/** Mark the router with ID digest as non-running in our routerlist. */ void router_mark_as_down(const char *digest) { routerinfo_t *router; tor_assert(digest); -- cgit v1.2.3