Fix compiler warnings about unused variables

Fixes #40743

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet
2023-01-19 09:38:21 -05:00
parent 49f10c5130
commit d02d2a4338
6 changed files with 32 additions and 32 deletions
+14 -10
View 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);
}
}
+2 -8
View 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);
-2
View 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));
-2
View 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);
+1
View 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));
+15 -10
View 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();