[tor-commits] [tor/master] circuit: Log n_circ_id and global identifier

nickm at torproject.org nickm at torproject.org
Wed Sep 20 17:54:01 UTC 2017


commit 317dabc57fcf51186e81ffa2db83a8116183866d
Author: David Goulet <dgoulet at torproject.org>
Date:   Wed Sep 20 11:56:44 2017 -0400

    circuit: Log n_circ_id and global identifier
    
    When we can, log the n circuit id and global identifier for origin circuit.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/or/circuitlist.c | 14 +++++++++++---
 src/or/circuituse.c  | 10 +++++++---
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index a0ff74190..9577573ec 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1027,6 +1027,11 @@ circuit_free(circuit_t *circ)
    * "active" checks will be violated. */
   cell_queue_clear(&circ->n_chan_cells);
 
+  log_info(LD_CIRC, "Circuit %u (id: %" PRIu32 ") has been freed.",
+           circ->n_circ_id,
+           CIRCUIT_IS_ORIGIN(circ) ?
+              TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0);
+
   if (should_free) {
     memwipe(mem, 0xAA, memlen); /* poison memory */
     tor_free(mem);
@@ -1913,9 +1918,12 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line,
 
   smartlist_add(circuits_pending_close, circ);
 
-  log_info(LD_GENERAL, "Circuit %u marked for close at %s:%d (orig reason: "
-                       "%u, new reason: %u)",
-           circ->n_circ_id, file, line, orig_reason, reason);
+  log_info(LD_GENERAL, "Circuit %u (id: %" PRIu32 ") marked for close at "
+                       "%s:%d (orig reason: %u, new reason: %u)",
+           circ->n_circ_id,
+           CIRCUIT_IS_ORIGIN(circ) ?
+              TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0,
+           file, line, orig_reason, reason);
 }
 
 /** Called immediately before freeing a marked circuit <b>circ</b> from
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 8ffb50604..e6f1e4df8 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -1752,13 +1752,17 @@ circuit_build_failed(origin_circuit_t *circ)
         already_marked = 1;
       }
       log_info(LD_OR,
-               "Our circuit failed to get a response from the first hop "
-               "(%s). I'm going to try to rotate to a better connection.",
+               "Our circuit %u (id: %" PRIu32 ") failed to get a response "
+               "from the first hop (%s). I'm going to try to rotate to a "
+               "better connection.",
+               TO_CIRCUIT(circ)->n_circ_id, circ->global_identifier,
                channel_get_canonical_remote_descr(n_chan));
       n_chan->is_bad_for_new_circs = 1;
     } else {
       log_info(LD_OR,
-               "Our circuit died before the first hop with no connection");
+               "Our circuit %u (id: %" PRIu32 ") died before the first hop "
+               "with no connection",
+               TO_CIRCUIT(circ)->n_circ_id, circ->global_identifier);
     }
     if (n_chan_id && !already_marked) {
       /* New guard API: we failed. */





More information about the tor-commits mailing list