Report the states of failed TLS connections from bootstrap_problem

This commit is contained in:
Nick Mathewson 2011-06-28 14:29:29 -04:00
parent b25ca8af06
commit b0de8560f6
2 changed files with 13 additions and 1 deletions

5
changes/feature3116 Normal file
View File

@ -0,0 +1,5 @@
o Major features:
- While we're trying to bootstrap, record how many TLS connections
fail in each state, and report which states saw the most failures
in response to any bootstrap failures. This feature may speed up
diagnosis of censorship events.

View File

@ -18,6 +18,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
#include "directory.h"
#include "dirserv.h"
@ -4268,6 +4269,7 @@ control_event_bootstrap_problem(const char *warn, int reason)
const char *tag, *summary;
char buf[BOOTSTRAP_MSG_LEN];
const char *recommendation = "ignore";
int severity;
/* bootstrap_percent must not be in "undefined" state here. */
tor_assert(status >= 0);
@ -4292,12 +4294,17 @@ control_event_bootstrap_problem(const char *warn, int reason)
status--; /* find a recognized status string based on current progress */
status = bootstrap_percent; /* set status back to the actual number */
log_fn(!strcmp(recommendation, "warn") ? LOG_WARN : LOG_INFO,
severity = !strcmp(recommendation, "warn") ? LOG_WARN : LOG_INFO;
log_fn(severity,
LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
"count %d; recommendation %s)",
status, summary, warn,
orconn_end_reason_to_control_string(reason),
bootstrap_problems, recommendation);
connection_or_report_broken_states(severity, LD_HANDSHAKE);
tor_snprintf(buf, sizeof(buf),
"BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
"COUNT=%d RECOMMENDATION=%s",