summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/connection_or.c17
-rw-r--r--src/or/connection_or.h2
4 files changed, 17 insertions, 6 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 6a411d1945..0e1dd524f6 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2117,7 +2117,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
"Looks like client functionality is working.");
control_event_bootstrap(BOOTSTRAP_STATUS_DONE, 0);
control_event_client_status(LOG_NOTICE, "CIRCUIT_ESTABLISHED");
- clear_broken_connection_map();
+ clear_broken_connection_map(1);
if (server_mode(options) && !check_whether_orport_reachable()) {
inform_testing_reachability();
consider_testing_reachability(1, 1);
diff --git a/src/or/connection.c b/src/or/connection.c
index b0e0f84371..d82a66ed7d 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -555,7 +555,7 @@ connection_free_all(void)
connection_or_clear_identity_map();
/* Clear out our list of broken connections */
- clear_broken_connection_map();
+ clear_broken_connection_map(0);
SMARTLIST_FOREACH(conns, connection_t *, conn, _connection_free(conn));
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index e755c7eb8e..94f8e227bb 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -158,12 +158,18 @@ connection_or_set_identity_digest(or_connection_t *conn, const char *digest)
*/
static strmap_t *broken_connection_counts;
+/** If true, do not record information in <b>broken_connection_counts</b>. */
+static int disable_broken_connection_counts = 0;
+
/** Record that an OR connection failed in <b>state</b>. */
static void
note_broken_connection(const char *state)
{
void *ptr;
intptr_t val;
+ if (disable_broken_connection_counts)
+ return;
+
if (!broken_connection_counts)
broken_connection_counts = strmap_new();
@@ -174,13 +180,16 @@ note_broken_connection(const char *state)
strmap_set(broken_connection_counts, state, ptr);
}
-/** Forget all recorded states for failed connections. */
+/** Forget all recorded states for failed connections. If
+ * <b>stop_recording</b> is true, don't record any more. */
void
-clear_broken_connection_map(void)
+clear_broken_connection_map(int stop_recording)
{
if (broken_connection_counts)
strmap_free(broken_connection_counts, NULL);
broken_connection_counts = NULL;
+ if (stop_recording)
+ disable_broken_connection_counts = 1;
}
/** Write a detailed description the state of <b>orconn</b> into the
@@ -209,6 +218,8 @@ static void
connection_or_note_state_when_broken(or_connection_t *orconn)
{
char buf[256];
+ if (disable_broken_connection_counts)
+ return;
connection_or_get_state_description(orconn, buf, sizeof(buf));
log_info(LD_HANDSHAKE,"Connection died in state '%s'", buf);
note_broken_connection(buf);
@@ -240,7 +251,7 @@ connection_or_report_broken_states(int severity, int domain)
int total = 0;
smartlist_t *items;
- if (!broken_connection_counts)
+ if (!broken_connection_counts || disable_broken_connection_counts)
return;
items = smartlist_create();
diff --git a/src/or/connection_or.h b/src/or/connection_or.h
index abcfe83b99..072edbd8cf 100644
--- a/src/or/connection_or.h
+++ b/src/or/connection_or.h
@@ -14,7 +14,7 @@
void connection_or_remove_from_identity_map(or_connection_t *conn);
void connection_or_clear_identity_map(void);
-void clear_broken_connection_map(void);
+void clear_broken_connection_map(int disable);
or_connection_t *connection_or_get_for_extend(const char *digest,
const tor_addr_t *target_addr,
const char **msg_out,