]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
refuse to build a circuit before the directory has arrived
authorRoger Dingledine <arma@torproject.org>
Tue, 13 Jul 2004 01:25:39 +0000 (01:25 +0000)
committerRoger Dingledine <arma@torproject.org>
Tue, 13 Jul 2004 01:25:39 +0000 (01:25 +0000)
this will prevent a few of the 'couldn't decrypt onionskin' errors, maybe

svn:r2036

src/or/circuitbuild.c
src/or/circuituse.c

index ca92186c3e5ee38415de2814f8015a50ab004e68..fe158a8f3ed128db10331a734858d8a434e85c88 100644 (file)
@@ -726,8 +726,6 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
   return 0;
 }
 
-extern int has_fetched_directory; /* from main.c */
-
 /** Choose a length for a circuit of purpose <b>purpose</b>.
  * Default length is 3 + the number of endpoints that would give something
  * away. If the routerlist <b>routers</b> doesn't have enough routers
index 9b971f599ea9fccde4c2b7630480ffe801cab466..d6422d0b54386b7feff642d5afcbc5599a090b5a 100644 (file)
@@ -14,6 +14,7 @@ extern or_options_t options; /* command-line and config-file options */
 /********* START VARIABLES **********/
 
 extern circuit_t *global_circuitlist; /* from circuitlist.c */
+extern int has_fetched_directory; /* from main.c */
 
 /********* END VARIABLES ************/
 
@@ -590,6 +591,11 @@ static int n_circuit_failures = 0;
 
 circuit_t *circuit_launch_by_identity(uint8_t purpose, const char *exit_digest)
 {
+  if (!has_fetched_directory) {
+    log_fn(LOG_DEBUG,"Haven't fetched directory yet; cancelling circuit launch.");
+    return NULL;
+  }
+
   if (n_circuit_failures > MAX_CIRCUIT_FAILURES) {
     /* too many failed circs in a row. don't try. */
 //    log_fn(LOG_INFO,"%d failures so far, not trying.",n_circuit_failures);