]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
only build circuits after we've fetched the directory
authorRoger Dingledine <arma@torproject.org>
Sat, 27 Mar 2004 00:15:09 +0000 (00:15 +0000)
committerRoger Dingledine <arma@torproject.org>
Sat, 27 Mar 2004 00:15:09 +0000 (00:15 +0000)
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.

svn:r1350

src/or/main.c

index 491a5ef82d444a31c6668089a24b95f413f0b3c3..e86f20b220f77881acdfc040b7f26d69de55e594 100644 (file)
@@ -35,7 +35,8 @@ static int please_reap_children=0; /* whether we should waitpid for exited child
 
 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 @@ static void run_scheduled_events(time_t now) {
    *    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 */