summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-02-29 01:31:33 +0000
committerRoger Dingledine <arma@torproject.org>2004-02-29 01:31:33 +0000
commit4716d4d8715f25ed2536f3c6fb35e5d3392669c4 (patch)
tree63d6554d99dbb5aac78d2ee75327f45a6bf70769
parentb4338ce704efbc1f9d2ade37e21dfed9a2465e66 (diff)
downloadtor-4716d4d8715f25ed2536f3c6fb35e5d3392669c4.tar.gz
tor-4716d4d8715f25ed2536f3c6fb35e5d3392669c4.zip
bugfix: only warn about an unrouter router after we've fetched a directory
svn:r1178
-rw-r--r--src/or/directory.c2
-rw-r--r--src/or/main.c10
-rw-r--r--src/or/onion.c14
-rw-r--r--src/or/routerlist.c3
4 files changed, 24 insertions, 5 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 33da6e253b..698e752d72 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -10,6 +10,7 @@ static int directory_handle_command(connection_t *conn);
/********* START VARIABLES **********/
extern or_options_t options; /* command-line and config-file options */
+extern int has_fetched_directory;
static char fetchstring[] = "GET / HTTP/1.0\r\n\r\n";
static char answerstring[] = "HTTP/1.0 200 OK\r\n\r\n";
@@ -129,6 +130,7 @@ int connection_dir_process_inbuf(connection_t *conn) {
} else {
log_fn(LOG_INFO,"updated routers.");
}
+ has_fetched_directory=1;
if(options.ORPort) { /* connect to them all */
router_retry_connections();
}
diff --git a/src/or/main.c b/src/or/main.c
index 831f0c7852..07a0d30158 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -4,7 +4,7 @@
#include "or.h"
-/********* START PROTOTYPES **********/
+/********* PROTOTYPES **********/
static void dumpstats(int severity); /* log stats */
static int init_from_config(int argc, char **argv);
@@ -34,6 +34,14 @@ static int please_reset=0; /* whether we just got a sighup */
static int please_reap_children=0; /* whether we should waitpid for exited children */
#endif /* signal stuff */
+int has_fetched_directory=0;
+/* we set this to 1 when we've fetched a dir, to know whether to complain
+ * yet about unrecognized nicknames in entrynodes, exitnodes, etc. */
+
+int has_completed_circuit=0;
+/* we set this to 1 when we've opened a circuit, so we can print a log
+ * entry to inform the user that Tor is working. */
+
/********* END VARIABLES ************/
/****************************************************************************
diff --git a/src/or/onion.c b/src/or/onion.c
index 13e22dd191..4b1969560a 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -157,6 +157,8 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
return 0;
}
+extern int has_fetched_directory;
+
static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) {
char *start,*end;
char nick[MAX_NICKNAME_LEN];
@@ -170,10 +172,14 @@ static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) {
memcpy(nick,start,end-start);
nick[end-start] = 0; /* null terminate it */
router = router_get_by_nickname(nick);
- if(router && router->is_running)
- smartlist_add(sl,router);
- else
- log_fn(LOG_WARN,"Nickname list includes '%s' which isn't a known router.",nick);
+ if (router) {
+ if (router->is_running)
+ smartlist_add(sl,router);
+ else
+ log_fn(LOG_WARN,"Nickname list includes '%s' which is known but down.",nick);
+ } else
+ log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO,
+ "Nickname list includes '%s' which isn't a known router.",nick);
while(isspace(*end) || *end==',') end++;
start = end;
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 42d4f4480d..19c0d70ef4 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -95,6 +95,8 @@ router_release_token(directory_token_t *tok);
/****************************************************************************/
+extern int has_fetched_directory;
+
/* try to find a running dirserver. if there are no dirservers
* in our routerlist, reload the routerlist and try again. */
routerinfo_t *router_pick_directory_server(void) {
@@ -103,6 +105,7 @@ routerinfo_t *router_pick_directory_server(void) {
choice = router_pick_directory_server_impl();
if(!choice) {
log_fn(LOG_WARN,"No dirservers known. Reloading and trying again.");
+ has_fetched_directory=0; /* reset it */
if(options.RouterFile) {
if(router_set_routerlist_from_file(options.RouterFile) < 0)
return NULL;