[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] bugfix: only warn about an unrouter router after we"ve fetc...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	directory.c main.c onion.c routerlist.c 
Log Message:
bugfix: only warn about an unrouter router after we've fetched a directory


Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- directory.c	28 Feb 2004 04:34:27 -0000	1.59
+++ directory.c	29 Feb 2004 01:31:32 -0000	1.60
@@ -10,6 +10,7 @@
 /********* 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 @@
         } else {
           log_fn(LOG_INFO,"updated routers.");
         }
+        has_fetched_directory=1;
         if(options.ORPort) { /* connect to them all */
           router_retry_connections();
         }

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- main.c	28 Feb 2004 23:23:06 -0000	1.180
+++ main.c	29 Feb 2004 01:31:32 -0000	1.181
@@ -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_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 ************/
 
 /****************************************************************************

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- onion.c	28 Feb 2004 07:48:28 -0000	1.127
+++ onion.c	29 Feb 2004 01:31:32 -0000	1.128
@@ -157,6 +157,8 @@
   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 @@
     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;
   }

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- routerlist.c	26 Feb 2004 22:56:36 -0000	1.28
+++ routerlist.c	29 Feb 2004 01:31:33 -0000	1.29
@@ -95,6 +95,8 @@
 
 /****************************************************************************/
 
+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 @@
   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;