summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-06-19 04:50:06 +0000
committerRoger Dingledine <arma@torproject.org>2008-06-19 04:50:06 +0000
commitd76d0493d64c512e36e1bd1d3b9e9aaf73f7df1e (patch)
tree5a33f4fe5462d4211654ab91a5f798c9396c312a /src/or/control.c
parentad6b2e75233168fbe27052f56e201fc355d63e98 (diff)
downloadtor-d76d0493d64c512e36e1bd1d3b9e9aaf73f7df1e.tar.gz
tor-d76d0493d64c512e36e1bd1d3b9e9aaf73f7df1e.zip
start sending "COUNT=%d RECOMMENDATION=%s" key/values on bootstrap
problem status events, so the controller can hear about problems even before tor decides they're worth reporting for sure. svn:r15357
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/or/control.c b/src/or/control.c
index bb756b4eef..bef6028c75 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3858,12 +3858,15 @@ control_event_bootstrap_problem(const char *warn, int reason)
int status = bootstrap_percent;
const char *tag, *summary;
char buf[BOOTSTRAP_MSG_LEN];
+ const char *recommendation = "ignore";
if (bootstrap_percent == 100)
return; /* already bootstrapped; nothing to be done here. */
- if (++bootstrap_problems != BOOTSTRAP_PROBLEM_THRESHOLD)
- return; /* no worries yet */
+ bootstrap_problems++;
+
+ if (bootstrap_problems >= BOOTSTRAP_PROBLEM_THRESHOLD)
+ recommendation = "warn";
while (status>=0 && bootstrap_status_to_string(status, &tag, &summary) < 0)
status--; /* find a recognized status string based on current progress */
@@ -3872,9 +3875,11 @@ control_event_bootstrap_problem(const char *warn, int reason)
status, summary, warn,
orconn_end_reason_to_control_string(reason));
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",
bootstrap_percent, tag, summary, warn,
- orconn_end_reason_to_control_string(reason));
+ orconn_end_reason_to_control_string(reason), bootstrap_problems,
+ recommendation);
tor_snprintf(last_sent_bootstrap_message,
sizeof(last_sent_bootstrap_message),
"WARN %s", buf);