浏览代码

Fix bootstrap directory information logging.

`dir_info_status` is used from main.c:directory_info_has_arrived() to
provide useful (INFO/NOTICE) level logging to users, and should always
be updated regardless of the rate limiting.
Yawning Angel 10 年之前
父节点
当前提交
8571e86d27
共有 2 个文件被更改,包括 19 次插入10 次删除
  1. 5 0
      changes/bug14918
  2. 14 10
      src/or/nodelist.c

+ 5 - 0
changes/bug14918

@@ -8,3 +8,8 @@
     - When deciding whether we have any exit nodes, only do processing for
     - When deciding whether we have any exit nodes, only do processing for
       ExitNodes when the ExitNodes option is actually set. Fixes part of
       ExitNodes when the ExitNodes option is actually set. Fixes part of
       bug 14918; bugfix on 0.2.6.2-alpha.
       bug 14918; bugfix on 0.2.6.2-alpha.
+
+  o Minor bugfixes (logging during bootstrap):
+    - Correctly update and log the amount of directory information that
+      has been fetched during the bootstrap process. Fixes part of bug
+      14918; bugfix on 0.2.6.2-alpha.

+ 14 - 10
src/or/nodelist.c

@@ -1685,12 +1685,14 @@ update_router_have_minimum_dir_info(void)
       static ratelim_t last_warned =
       static ratelim_t last_warned =
         RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL);
         RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL);
       char *suppression_msg = NULL;
       char *suppression_msg = NULL;
+
+      tor_snprintf(dir_info_status, sizeof(dir_info_status),
+                   "We need more %sdescriptors: we have %d/%d, and "
+                   "can only build %d%% of likely paths. (We have %s.)",
+                   using_md?"micro":"", num_present, num_usable,
+                   (int)(paths*100), status);
+
       if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) {
       if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) {
-        tor_snprintf(dir_info_status, sizeof(dir_info_status),
-                     "We need more %sdescriptors: we have %d/%d, and "
-                     "can only build %d%% of likely paths. (We have %s.)",
-                     using_md?"micro":"", num_present, num_usable,
-                     (int)(paths*100), status);
         if (!should_delay_dir_fetches(options, NULL) &&
         if (!should_delay_dir_fetches(options, NULL) &&
             !directory_too_idle_to_fetch_descriptors(options, now)) {
             !directory_too_idle_to_fetch_descriptors(options, now)) {
           log_warn(LD_NET, "%s%s", dir_info_status, suppression_msg);
           log_warn(LD_NET, "%s%s", dir_info_status, suppression_msg);
@@ -1706,12 +1708,14 @@ update_router_have_minimum_dir_info(void)
       static ratelim_t last_warned =
       static ratelim_t last_warned =
       RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL);
       RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL);
       char *suppression_msg = NULL;
       char *suppression_msg = NULL;
+
+      tor_snprintf(dir_info_status, sizeof(dir_info_status),
+                   "We have enough %sdescriptors: we have %d/%d, and "
+                   "can build %d%% of likely paths. (We have %s.)",
+                   using_md?"micro":"", num_present, num_usable,
+                   (int)(paths*100), status);
+
       if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) {
       if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) {
-        tor_snprintf(dir_info_status, sizeof(dir_info_status),
-                     "We have enough %sdescriptors: we have %d/%d, and "
-                     "can build %d%% of likely paths. (We have %s.)",
-                     using_md?"micro":"", num_present, num_usable,
-                     (int)(paths*100), status);
         log_info(LD_NET, "%s%s", dir_info_status, suppression_msg);
         log_info(LD_NET, "%s%s", dir_info_status, suppression_msg);
         tor_free(suppression_msg);
         tor_free(suppression_msg);
       }
       }