aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2015-11-14 13:08:24 -0800
committerNick Mathewson <nickm@torproject.org>2017-05-08 13:49:22 -0400
commit76c9330f9d41af48b64c0abe7a53749f1ee0d601 (patch)
tree4caef7fa2e5a80157ec9133a150f44f5cfb30434 /src/or/main.c
parentd5a151a06788c28ac1c50398c6e571d484774f47 (diff)
downloadtor-76c9330f9d41af48b64c0abe7a53749f1ee0d601.tar.gz
tor-76c9330f9d41af48b64c0abe7a53749f1ee0d601.zip
Bug 17604: Converge on only one long-lived TLS conn between relays.
Accomplished via the following: 1. Use NETINFO cells to determine if both peers will agree on canonical status. Prefer connections where they agree to those where they do not. 2. Alter channel_is_better() to prefer older orconns in the case of multiple canonical connections, and use the orconn with more circuits on it in case of age ties. Also perform some hourly accounting on how many of these types of connections there are and log it at info or notice level.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index e124441041..5bc132a0e3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1189,6 +1189,7 @@ CALLBACK(write_bridge_ns);
CALLBACK(check_fw_helper_app);
CALLBACK(heartbeat);
CALLBACK(reset_padding_counts);
+CALLBACK(check_canonical_channels);
#undef CALLBACK
@@ -1221,6 +1222,7 @@ static periodic_event_item_t periodic_events[] = {
CALLBACK(check_fw_helper_app),
CALLBACK(heartbeat),
CALLBACK(reset_padding_counts),
+ CALLBACK(check_canonical_channels),
END_OF_PERIODIC_EVENTS
};
#undef CALLBACK
@@ -1726,9 +1728,17 @@ write_stats_file_callback(time_t now, const or_options_t *options)
return safe_timer_diff(now, next_time_to_write_stats_files);
}
-/**
- * Periodic callback: Write bridge statistics to disk if appropriate.
- */
+#define CHANNEL_CHECK_INTERVAL (60*60)
+static int
+check_canonical_channels_callback(time_t now, const or_options_t *options)
+{
+ (void)now;
+ if (public_server_mode(options))
+ channel_check_for_duplicates();
+
+ return CHANNEL_CHECK_INTERVAL;
+}
+
static int
reset_padding_counts_callback(time_t now, const or_options_t *options)
{
@@ -1740,6 +1750,9 @@ reset_padding_counts_callback(time_t now, const or_options_t *options)
return REPHIST_CELL_PADDING_COUNTS_INTERVAL;
}
+/**
+ * Periodic callback: Write bridge statistics to disk if appropriate.
+ */
static int
record_bridge_stats_callback(time_t now, const or_options_t *options)
{