Include a HOST item in BOOTSTRAP problem messages

Closes ticket 15006.
This commit is contained in:
Nick Mathewson 2015-02-27 11:28:30 -05:00
parent 0f2f8fd68a
commit 79c69d18b7
2 changed files with 11 additions and 4 deletions

4
changes/feature15006 Normal file
View File

@ -0,0 +1,4 @@
o Minor features (controller):
- Messages about problems in the bootstrap process now include
information about the server we were trying to connect to when we
noticed the problem. Closes ticket 15006.

View File

@ -5049,6 +5049,7 @@ MOCK_IMPL(void,
char buf[BOOTSTRAP_MSG_LEN]; char buf[BOOTSTRAP_MSG_LEN];
const char *recommendation = "ignore"; const char *recommendation = "ignore";
int severity; int severity;
char host[128];
/* bootstrap_percent must not be in "undefined" state here. */ /* bootstrap_percent must not be in "undefined" state here. */
tor_assert(status >= 0); tor_assert(status >= 0);
@ -5078,6 +5079,8 @@ MOCK_IMPL(void,
if (we_are_hibernating()) if (we_are_hibernating())
recommendation = "ignore"; recommendation = "ignore";
orconn_target_get_name(host, sizeof(host), or_conn);
while (status>=0 && bootstrap_status_to_string(status, &tag, &summary) < 0) while (status>=0 && bootstrap_status_to_string(status, &tag, &summary) < 0)
status--; /* find a recognized status string based on current progress */ status--; /* find a recognized status string based on current progress */
status = bootstrap_percent; /* set status back to the actual number */ status = bootstrap_percent; /* set status back to the actual number */
@ -5086,19 +5089,19 @@ MOCK_IMPL(void,
log_fn(severity, log_fn(severity,
LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; " LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
"count %d; recommendation %s)", "count %d; recommendation %s; host %s)",
status, summary, warn, status, summary, warn,
orconn_end_reason_to_control_string(reason), orconn_end_reason_to_control_string(reason),
bootstrap_problems, recommendation); bootstrap_problems, recommendation, host);
connection_or_report_broken_states(severity, LD_HANDSHAKE); connection_or_report_broken_states(severity, LD_HANDSHAKE);
tor_snprintf(buf, sizeof(buf), tor_snprintf(buf, sizeof(buf),
"BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s " "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
"COUNT=%d RECOMMENDATION=%s", "COUNT=%d RECOMMENDATION=%s HOST=\"%s\"",
bootstrap_percent, tag, summary, warn, bootstrap_percent, tag, summary, warn,
orconn_end_reason_to_control_string(reason), bootstrap_problems, orconn_end_reason_to_control_string(reason), bootstrap_problems,
recommendation); recommendation, host);
tor_snprintf(last_sent_bootstrap_message, tor_snprintf(last_sent_bootstrap_message,
sizeof(last_sent_bootstrap_message), sizeof(last_sent_bootstrap_message),
"WARN %s", buf); "WARN %s", buf);