[tor-commits] [tor] branch main updated: Fix compiler warnings about unused variables
gitolite role
git at cupani.torproject.org
Thu Jan 19 16:18:50 UTC 2023
This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main
in repository tor.
The following commit(s) were added to refs/heads/main by this push:
new d02d2a4338 Fix compiler warnings about unused variables
d02d2a4338 is described below
commit d02d2a4338bdade748b334ec01abac0cdaf76563
Author: David Goulet <dgoulet at torproject.org>
AuthorDate: Thu Jan 19 09:38:21 2023 -0500
Fix compiler warnings about unused variables
Fixes #40743
Signed-off-by: David Goulet <dgoulet at torproject.org>
---
src/core/or/channel.c | 24 ++++++++++++++----------
src/core/or/connection_or.c | 10 ++--------
src/feature/nodelist/routerlist.c | 2 --
src/lib/evloop/compat_libevent.c | 2 --
src/test/bench.c | 1 +
src/test/test_channel.c | 25 +++++++++++++++----------
6 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index c46fa93e58..9d15d35ac9 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -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);
}
}
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index dd93628654..343c1a67ed 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -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);
diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c
index 9f0f845126..f3875670f0 100644
--- a/src/feature/nodelist/routerlist.c
+++ b/src/feature/nodelist/routerlist.c
@@ -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));
diff --git a/src/lib/evloop/compat_libevent.c b/src/lib/evloop/compat_libevent.c
index fd840f8085..c882d3478e 100644
--- a/src/lib/evloop/compat_libevent.c
+++ b/src/lib/evloop/compat_libevent.c
@@ -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);
diff --git a/src/test/bench.c b/src/test/bench.c
index a76ea67eb8..a76e600cfa 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -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));
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index a74d69fefc..a6f403a25c 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -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();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list