]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
rearrange to prepare to solve the authdirserver initialization
authorRoger Dingledine <arma@torproject.org>
Wed, 21 Jul 2004 07:50:06 +0000 (07:50 +0000)
committerRoger Dingledine <arma@torproject.org>
Wed, 21 Jul 2004 07:50:06 +0000 (07:50 +0000)
precedence problem. doesn't actually solve it yet.

svn:r2079

src/or/main.c
src/or/router.c
src/or/routerlist.c

index 759487c0aebe877d66e3f6d9684dbc012182c8c1..b3898fff39755aa0e706dfb9c167d627bef001f0 100644 (file)
@@ -763,13 +763,6 @@ static int do_main_loop(void) {
   /* Intialize the service cache. */
   rend_cache_init();
 
-  /* load the private keys, if we're supposed to have them, and set up the
-   * TLS context. */
-  if (init_keys() < 0 || rend_service_load_keys() < 0) {
-    log_fn(LOG_ERR,"Error initializing keys; exiting");
-    return -1;
-  }
-
   /* load the routers file */
   if(options.RouterFile) {
     routerlist_clear_trusted_directories();
@@ -779,6 +772,13 @@ static int do_main_loop(void) {
     }
   }
 
+  /* load the private keys, if we're supposed to have them, and set up the
+   * TLS context. */
+  if (init_keys() < 0 || rend_service_load_keys() < 0) {
+    log_fn(LOG_ERR,"Error initializing keys; exiting");
+    return -1;
+  }
+
   if(authdir_mode()) {
     /* the directory is already here, run startup things */
     directory_has_arrived();
index 5783708933ad5f05a6fba7cc7fb9cef8c1dc5b2e..c0f3cbce6d561a8822868b0f889ee31eac26b236 100644 (file)
@@ -509,6 +509,8 @@ int router_rebuild_descriptor(void) {
   ri->bandwidthburst = options.BandwidthBurst;
   ri->exit_policy = NULL; /* zero it out first */
   router_add_exit_policy_from_config(ri);
+  ri->is_trusted_dir = (ri->dir_port &&
+    router_digest_is_trusted_dir(ri->identity_digest));
   if (desc_routerinfo)
     routerinfo_free(desc_routerinfo);
   desc_routerinfo = ri;
@@ -516,8 +518,6 @@ int router_rebuild_descriptor(void) {
     log_fn(LOG_WARN, "Couldn't dump router to string.");
     return -1;
   }
-  ri->is_trusted_dir = (ri->dir_port &&
-    router_digest_is_trusted_dir(ri->identity_digest));
   return 0;
 }
 
index 250e7d2a87b181bf14b534fed30b34f898a66475..2ba74d7eaee9c20f44199187e9ca46480faafa40 100644 (file)
@@ -571,6 +571,7 @@ int router_load_routerlist_from_string(const char *s, int trusted)
       routerinfo_t *r = smartlist_get(new_list->routers, i);
       if (r->dir_port) {
         char *b;
+        log_fn(LOG_DEBUG,"Trusting router %s.", r->nickname);
         r->is_trusted_dir = 1;
         b = tor_malloc(DIGEST_LEN);
         memcpy(b, r->identity_digest, DIGEST_LEN);