[or-cvs] only build circuits after we"ve fetched the directory

Roger Dingledine arma at seul.org
Sat Mar 27 00:15:11 UTC 2004


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

Modified Files:
	main.c 
Log Message:
only build circuits after we've fetched the directory

this resolves a subtle bug where tor clients were preferentially using
the directory servers, since when they start building circuits they
know only about the directory servers

on the other hand, it now takes longer after startup before there's
a working circuit. so it goes.


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- main.c	21 Mar 2004 03:03:10 -0000	1.207
+++ main.c	27 Mar 2004 00:15:09 -0000	1.208
@@ -35,7 +35,8 @@
 
 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. */
+ * yet about unrecognized nicknames in entrynodes, exitnodes, etc.
+ * Also, we don't try building circuits unless this is 1. */
 
 int has_completed_circuit=0;
 /* we set this to 1 when we've opened a circuit, so we can print a log
@@ -354,7 +355,8 @@
    *    that became dirty more than NewCircuitPeriod seconds ago,
    *    and we make a new circ if there are no clean circuits.
    */
-  if(options.SocksPort || options.RunTesting) {
+  if((has_fetched_directory || options.DirPort) &&
+     (options.SocksPort || options.RunTesting)) {
 
     if (options.SocksPort)
       /* launch a new circ for any pending streams that need one */



More information about the tor-commits mailing list