]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix compiler warnings about unused variables
authorDavid Goulet <dgoulet@torproject.org>
Thu, 19 Jan 2023 14:38:21 +0000 (09:38 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 19 Jan 2023 16:18:02 +0000 (11:18 -0500)
Fixes #40743

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/core/or/channel.c
src/core/or/connection_or.c
src/feature/nodelist/routerlist.c
src/lib/evloop/compat_libevent.c
src/test/bench.c
src/test/test_channel.c

index c46fa93e587d09f1b6ab2377fabd2cd1455857b1..9d15d35ac971d7ff46918e8f4ac7ab854eae36ca 100644 (file)
@@ -817,22 +817,26 @@ channel_check_for_duplicates(void)
     log_notice(LD_OR,
         "Your relay has a very large number of connections to other relays. "
         "Is your outbound address the same as your relay address? "
-        "Found %d connections to %d relays. Found %d current canonical "
-        "connections, in %d of which we were a non-canonical peer. "
+        "Found %d connections to authorities, %d connections to %d relays. "
+        "Found %d current canonical connections, "
+        "in %d of which we were a non-canonical peer. "
         "%d relays had more than 1 connection, %d had more than 2, and "
         "%d had more than 4 connections.",
-        total_relay_connections, total_relays, total_canonical,
-        total_half_canonical, total_gt_one_connection,
-        total_gt_two_connections, total_gt_four_connections);
+        total_dirauth_connections, total_relay_connections,
+        total_relays, total_canonical, total_half_canonical,
+        total_gt_one_connection, total_gt_two_connections,
+        total_gt_four_connections);
   } else {
     log_info(LD_OR, "Performed connection pruning. "
-        "Found %d connections to %d relays. Found %d current canonical "
-        "connections, in %d of which we were a non-canonical peer. "
+        "Found %d connections to authorities, %d connections to %d relays. "
+        "Found %d current canonical connections, "
+        "in %d of which we were a non-canonical peer. "
         "%d relays had more than 1 connection, %d had more than 2, and "
         "%d had more than 4 connections.",
-        total_relay_connections, total_relays, total_canonical,
-        total_half_canonical, total_gt_one_connection,
-        total_gt_two_connections, total_gt_four_connections);
+        total_dirauth_connections, total_relay_connections,
+        total_relays, total_canonical, total_half_canonical,
+        total_gt_one_connection, total_gt_two_connections,
+        total_gt_four_connections);
   }
 }
 
index dd9362865427930e58c1b28c22fa68309461d2fb..343c1a67ed3ee7cf9b36c080e6d1acd772543b1a 100644 (file)
@@ -1080,7 +1080,7 @@ connection_or_group_set_badness_(smartlist_t *group, int force)
    * XXXX connections. */
 
   or_connection_t *best = NULL;
-  int n_old = 0, n_inprogress = 0, n_canonical = 0, n_other = 0;
+  int n_canonical = 0;
   time_t now = time(NULL);
 
   /* Pass 1: expire everything that's old, and see what the status of
@@ -1089,14 +1089,8 @@ connection_or_group_set_badness_(smartlist_t *group, int force)
     if (connection_or_single_set_badness_(now, or_conn, force))
       continue;
 
-    if (connection_or_is_bad_for_new_circs(or_conn)) {
-      ++n_old;
-    } else if (or_conn->base_.state != OR_CONN_STATE_OPEN) {
-      ++n_inprogress;
-    } else if (or_conn->is_canonical) {
+    if (or_conn->is_canonical) {
       ++n_canonical;
-    } else {
-      ++n_other;
     }
   } SMARTLIST_FOREACH_END(or_conn);
 
index 9f0f845126c4119ef845106c40c98dd2e03fe847..f3875670f07aa07ed98c4aa46260536f359a53da 100644 (file)
@@ -243,7 +243,6 @@ router_rebuild_store(int flags, desc_store_t *store)
   int r = -1;
   off_t offset = 0;
   smartlist_t *signed_descriptors = NULL;
-  int nocache=0;
   size_t total_expected_len = 0;
   int had_any;
   int force = flags & RRS_FORCE;
@@ -304,7 +303,6 @@ router_rebuild_store(int flags, desc_store_t *store)
         goto done;
       }
       if (sd->do_not_cache) {
-        ++nocache;
         continue;
       }
       c = tor_malloc(sizeof(sized_chunk_t));
index fd840f8085c9611fd7d671b6419e33641cdf5fef..c882d3478ec391372a29ec78a46e2825b901331d 100644 (file)
@@ -137,10 +137,8 @@ tor_libevent_initialize(tor_libevent_cfg_t *torcfg)
   (void)torcfg;
 
   {
-    int attempts = 0;
     struct event_config *cfg;
 
-    ++attempts;
     cfg = event_config_new();
     tor_assert(cfg);
 
index a76ea67eb84414ae084ffce12bcc53dc8ee0c227..a76e600cfacbc148abfb11d0df0dae6e5c83bf88 100644 (file)
@@ -380,6 +380,7 @@ bench_rand_len(int len)
     uint32_t t=0;
     for (i = 0; i < N; ++i) {
       t += tor_weak_random(&weak);
+      (void) t;
     }
     end = perftime();
     printf("weak_rand(4): %f nsec.\n", NANOCOUNT(start,end,N));
index a74d69fefc3d85423e4dff6499744a4f965f209e..a6f403a25cf3faa54b69b1d085f36a505af127cb 100644 (file)
@@ -1264,8 +1264,9 @@ test_channel_duplicates(void *arg)
   /* Try a flat call with channel nor connections. */
   channel_check_for_duplicates();
   expect_log_msg_containing(
-    "Found 0 connections to 0 relays. Found 0 current canonical "
-    "connections, in 0 of which we were a non-canonical peer. "
+    "Found 0 connections to authorities, 0 connections to 0 relays. "
+    "Found 0 current canonical connections, "
+    "in 0 of which we were a non-canonical peer. "
     "0 relays had more than 1 connection, 0 had more than 2, and "
     "0 had more than 4 connections.");
 
@@ -1285,8 +1286,9 @@ test_channel_duplicates(void *arg)
   /* No relay has been associated with this channel. */
   channel_check_for_duplicates();
   expect_log_msg_containing(
-    "Found 0 connections to 0 relays. Found 0 current canonical "
-    "connections, in 0 of which we were a non-canonical peer. "
+    "Found 0 connections to authorities, 0 connections to 0 relays. "
+    "Found 0 current canonical connections, "
+    "in 0 of which we were a non-canonical peer. "
     "0 relays had more than 1 connection, 0 had more than 2, and "
     "0 had more than 4 connections.");
 
@@ -1299,24 +1301,27 @@ test_channel_duplicates(void *arg)
   chan->state = CHANNEL_STATE_CLOSING;
   channel_check_for_duplicates();
   expect_log_msg_containing(
-    "Found 0 connections to 0 relays. Found 0 current canonical "
-    "connections, in 0 of which we were a non-canonical peer. "
+    "Found 0 connections to authorities, 0 connections to 0 relays. "
+    "Found 0 current canonical connections, "
+    "in 0 of which we were a non-canonical peer. "
     "0 relays had more than 1 connection, 0 had more than 2, and "
     "0 had more than 4 connections.");
   chan->state = CHANNEL_STATE_OPEN;
 
   channel_check_for_duplicates();
   expect_log_msg_containing(
-    "Found 1 connections to 1 relays. Found 0 current canonical "
-    "connections, in 0 of which we were a non-canonical peer. "
+    "Found 0 connections to authorities, 1 connections to 1 relays. "
+    "Found 0 current canonical connections, "
+    "in 0 of which we were a non-canonical peer. "
     "0 relays had more than 1 connection, 0 had more than 2, and "
     "0 had more than 4 connections.");
 
   test_chan_should_be_canonical = 1;
   channel_check_for_duplicates();
   expect_log_msg_containing(
-    "Found 1 connections to 1 relays. Found 1 current canonical "
-    "connections, in 1 of which we were a non-canonical peer. "
+    "Found 0 connections to authorities, 1 connections to 1 relays. "
+    "Found 1 current canonical connections, "
+    "in 1 of which we were a non-canonical peer. "
     "0 relays had more than 1 connection, 0 had more than 2, and "
     "0 had more than 4 connections.");
   teardown_capture_of_logs();