[tor-commits] [tor/master] use channel_is_client for create cell counts

nickm at torproject.org nickm at torproject.org
Mon Apr 2 12:48:50 UTC 2018


commit 61905932565a8ff426981d77bf162f85e7f6c3ea
Author: Roger Dingledine <arma at torproject.org>
Date:   Mon Apr 2 01:00:31 2018 -0400

    use channel_is_client for create cell counts
    
    When a relay is collecting internal statistics about how many
    create cell requests it has seen of each type, accurately count the
    requests from relays that temporarily fall out of the consensus.
    
    (To be extra conservative, we were already ignoring requests from clients
    in our counts, and we continue ignoring them here.)
    
    Fixes bug 24910; bugfix on 0.2.4.17-rc.
---
 changes/bug24910   | 7 +++++++
 src/or/command.c   | 4 +++-
 src/or/cpuworker.c | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/changes/bug24910 b/changes/bug24910
new file mode 100644
index 000000000..58574c006
--- /dev/null
+++ b/changes/bug24910
@@ -0,0 +1,7 @@
+  o Minor bugfixes (relay statistics):
+    - When a relay is collecting internal statistics about how many
+      create cell requests it has seen of each type, accurately count the
+      requests from relays that temporarily fall out of the consensus. (To
+      be extra conservative, we were already ignoring requests from
+      clients in our counts, and we continue ignoring them here.) Fixes
+      bug 24910; bugfix on 0.2.4.17-rc.
diff --git a/src/or/command.c b/src/or/command.c
index 7280be139..4f99462f3 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -339,7 +339,9 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
     return;
   }
 
-  if (connection_or_digest_is_known_relay(chan->identity_digest)) {
+  if (!channel_is_client(chan)) {
+    /* remember create types we've seen, but don't remember them from
+     * clients, to be extra conservative about client statistics. */
     rep_hist_note_circuit_handshake_requested(create_cell->handshake_type);
   }
 
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 50761dd4d..7da7dc5f8 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -547,7 +547,7 @@ assign_onionskin_to_cpuworker(or_circuit_t *circ,
     return 0;
   }
 
-  if (connection_or_digest_is_known_relay(circ->p_chan->identity_digest))
+  if (!channel_is_client(circ->p_chan))
     rep_hist_note_circuit_handshake_assigned(onionskin->handshake_type);
 
   should_time = should_time_request(onionskin->handshake_type);



More information about the tor-commits mailing list