[tor-commits] [tor/master] hs: Improve logging

nickm at torproject.org nickm at torproject.org
Tue Sep 26 12:57:20 UTC 2017


commit 648d5ea67e1bf362363f399c708bc3dcca5b26f6
Author: David Goulet <dgoulet at torproject.org>
Date:   Mon Sep 25 16:31:43 2017 -0400

    hs: Improve logging
    
    Also demote a log message that can occur under natural causes
    (if the circuit subsystem is missing descriptors/consensus etc.).
    The HS subsystem will naturally retry to connect to intro points,
    so no need to make that log user-facing.
---
 src/or/hs_service.c        | 9 ++++++---
 src/test/test_hs_service.c | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 50c231788..8c99f0747 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -1570,6 +1570,8 @@ pick_intro_point(unsigned int direct_conn, smartlist_t *exclude_nodes)
   if (ip == NULL) {
     goto err;
   }
+
+  log_info(LD_REND, "Picked intro point: %s", extend_info_describe(info));
   extend_info_free(info);
   return ip;
  err:
@@ -1725,11 +1727,12 @@ update_service_descriptor(hs_service_t *service,
                                                                  desc);
     if (num_new_intro_points != 0) {
       log_info(LD_REND, "Service %s just picked %u intro points and wanted "
-                        "%u. It currently has %d intro points. "
-                        "Launching ESTABLISH_INTRO circuit shortly.",
+                        "%u for %s descriptor. It currently has %d intro "
+                        "points. Launching ESTABLISH_INTRO circuit shortly.",
                safe_str_client(service->onion_address),
                num_new_intro_points,
                service->config.num_intro_points - num_intro_points,
+               (desc == service->desc_current) ? "current" : "next",
                num_intro_points);
       /* We'll build those introduction point into the descriptor once we have
        * confirmation that the circuits are opened and ready. However,
@@ -2046,7 +2049,7 @@ launch_intro_point_circuits(hs_service_t *service)
       /* Launch a circuit to the intro point. */
       ip->circuit_retries++;
       if (hs_circ_launch_intro_point(service, ip, ei) < 0) {
-        log_warn(LD_REND, "Unable to launch intro circuit to node %s "
+        log_info(LD_REND, "Unable to launch intro circuit to node %s "
                           "for service %s.",
                  safe_str_client(extend_info_describe(ei)),
                  safe_str_client(service->onion_address));
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 859476b70..3557974eb 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -1149,9 +1149,9 @@ test_build_update_descriptors(void *arg)
   tor_free(node->ri->onion_curve25519_pkey); /* Avoid memleak. */
   tor_free(node->ri->cache_info.signing_key_cert);
   crypto_pk_free(node->ri->onion_pkey);
-  expect_log_msg_containing("just picked 1 intro points and wanted 3. It "
-                            "currently has 0 intro points. Launching "
-                            "ESTABLISH_INTRO circuit shortly.");
+  expect_log_msg_containing("just picked 1 intro points and wanted 3 for next "
+                            "descriptor. It currently has 0 intro points. "
+                            "Launching ESTABLISH_INTRO circuit shortly.");
   teardown_capture_of_logs();
   tt_int_op(digest256map_size(service->desc_current->intro_points.map),
             OP_EQ, 1);





More information about the tor-commits mailing list