[tor-commits] [tor/master] Remove the unused circuit_dump_by_chan().

nickm at torproject.org nickm at torproject.org
Sun Mar 23 04:29:07 UTC 2014


commit f560eeadc38f3146f17c55b0d00799b3ee7d5acf
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Mar 23 00:28:39 2014 -0400

    Remove the unused circuit_dump_by_chan().
    
    Also remove its helper function.
---
 changes/bug9107      |    3 +++
 src/or/circuitlist.c |   66 --------------------------------------------------
 src/or/circuitlist.h |    1 -
 3 files changed, 3 insertions(+), 67 deletions(-)

diff --git a/changes/bug9107 b/changes/bug9107
new file mode 100644
index 0000000..dba1669
--- /dev/null
+++ b/changes/bug9107
@@ -0,0 +1,3 @@
+ o Code simplifications and refactoring: 
+   - Remove unused function circuit_dump_by_chan from circuitlist.c. Closes
+     issue #9107; patch from "marek".
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 867a9cd..b1efde5 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -930,72 +930,6 @@ circuit_dump_by_conn(connection_t *conn, int severity)
   }
 }
 
-/** A helper function for circuit_dump_by_chan() below. Log a bunch
- * of information about circuit <b>circ</b>.
- */
-static void
-circuit_dump_chan_details(int severity,
-                          circuit_t *circ,
-                          channel_t *chan,
-                          const char *type,
-                          circid_t this_circid,
-                          circid_t other_circid)
-{
-  tor_log(severity, LD_CIRC, "Conn %p has %s circuit: circID %u "
-      "(other side %u), state %d (%s), born %ld:",
-      chan, type, (unsigned)this_circid, (unsigned)other_circid, circ->state,
-      circuit_state_to_string(circ->state),
-      (long)circ->timestamp_began.tv_sec);
-  if (CIRCUIT_IS_ORIGIN(circ)) { /* circ starts at this node */
-    circuit_log_path(severity, LD_CIRC, TO_ORIGIN_CIRCUIT(circ));
-  }
-}
-
-/** Log, at severity <b>severity</b>, information about each circuit
- * that is connected to <b>chan</b>.
- */
-void
-circuit_dump_by_chan(channel_t *chan, int severity)
-{
-  circuit_t *circ;
-
-  tor_assert(chan);
-
-  TOR_LIST_FOREACH(circ, &global_circuitlist, head) {
-    circid_t n_circ_id = circ->n_circ_id, p_circ_id = 0;
-
-    if (circ->marked_for_close) {
-      continue;
-    }
-
-    if (!CIRCUIT_IS_ORIGIN(circ)) {
-      p_circ_id = TO_OR_CIRCUIT(circ)->p_circ_id;
-    }
-
-    if (! CIRCUIT_IS_ORIGIN(circ) && TO_OR_CIRCUIT(circ)->p_chan &&
-        TO_OR_CIRCUIT(circ)->p_chan == chan) {
-      circuit_dump_chan_details(severity, circ, chan, "App-ward",
-                                p_circ_id, n_circ_id);
-    }
-
-    if (circ->n_chan && circ->n_chan == chan) {
-      circuit_dump_chan_details(severity, circ, chan, "Exit-ward",
-                                n_circ_id, p_circ_id);
-    }
-
-    if (!circ->n_chan && circ->n_hop &&
-        channel_matches_extend_info(chan, circ->n_hop) &&
-        tor_memeq(chan->identity_digest,
-                  circ->n_hop->identity_digest, DIGEST_LEN)) {
-      circuit_dump_chan_details(severity, circ, chan,
-                                (circ->state == CIRCUIT_STATE_OPEN &&
-                                 !CIRCUIT_IS_ORIGIN(circ)) ?
-                                "Endpoint" : "Pending",
-                                n_circ_id, p_circ_id);
-    }
-  }
-}
-
 /** Return the circuit whose global ID is <b>id</b>, or NULL if no
  * such circuit exists. */
 origin_circuit_t *
diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h
index a29c29a..54a7ef4 100644
--- a/src/or/circuitlist.h
+++ b/src/or/circuitlist.h
@@ -22,7 +22,6 @@ const char *circuit_purpose_to_controller_string(uint8_t purpose);
 const char *circuit_purpose_to_controller_hs_state_string(uint8_t purpose);
 const char *circuit_purpose_to_string(uint8_t purpose);
 void circuit_dump_by_conn(connection_t *conn, int severity);
-void circuit_dump_by_chan(channel_t *chan, int severity);
 void circuit_set_p_circid_chan(or_circuit_t *circ, circid_t id,
                                channel_t *chan);
 void circuit_set_n_circid_chan(circuit_t *circ, circid_t id,



More information about the tor-commits mailing list