aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-06-08 02:53:32 +0000
committerRoger Dingledine <arma@torproject.org>2008-06-08 02:53:32 +0000
commit3bb5d3ba6d9720542e4e67f973c4ee7bda23f24a (patch)
treec0b464f1d4bdbad7c69e1e239d3ae68f370b24d0 /src/or
parent58c2a5379b5bc89e4bde9b07b2cb690715c1ec22 (diff)
downloadtor-3bb5d3ba6d9720542e4e67f973c4ee7bda23f24a.tar.gz
tor-3bb5d3ba6d9720542e4e67f973c4ee7bda23f24a.zip
include tags in the bootstrap status events. also document the
bootstrapping process and how the phases break down. svn:r15020
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/control.c96
2 files changed, 56 insertions, 42 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index ef251da233..2875222c76 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1059,7 +1059,7 @@ new_route_len(uint8_t purpose, extend_info_t *exit,
num_acceptable_routers = count_acceptable_routers(routers);
- log_debug(LD_CIRC,"Chosen route length %d (%d/%d routers available).",
+ log_debug(LD_CIRC,"Chosen route length %d (%d/%d routers suitable).",
routelen, num_acceptable_routers, smartlist_len(routers));
if (num_acceptable_routers < 2) {
diff --git a/src/or/control.c b/src/or/control.c
index c4a4e4932c..97ca13225a 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3823,43 +3823,72 @@ init_cookie_authentication(int enabled)
return 0;
}
-/** Convert the name of a bootstrapping phase <b>s</b> into a string
- * suitable for display by the controller. */
-static const char *
-bootstrap_status_to_string(bootstrap_status_t s)
+/** Convert the name of a bootstrapping phase <b>s</b> into strings
+ * <b>tag</b> and <b>summary</b> suitable for display by the controller. */
+static void
+bootstrap_status_to_string(bootstrap_status_t s, const char **tag,
+ const char **summary)
{
switch (s) {
case BOOTSTRAP_STATUS_STARTING:
- return "Starting";
+ *tag = "starting";
+ *summary = "Starting";
+ break;
case BOOTSTRAP_STATUS_CONN_DIR:
- return "Connecting to directory mirror";
+ *tag = "conn_dir";
+ *summary = "Connecting to directory mirror";
+ break;
case BOOTSTRAP_STATUS_HANDSHAKE:
- return "Finishing handshake";
+ *tag = "status_handshake";
+ *summary = "Finishing handshake";
+ break;
case BOOTSTRAP_STATUS_HANDSHAKE_DIR:
- return "Finishing handshake with directory mirror";
+ *tag = "handshake_dir";
+ *summary = "Finishing handshake with directory mirror";
+ break;
case BOOTSTRAP_STATUS_ONEHOP_CREATE:
- return "Establishing one-hop circuit for dir info";
+ *tag = "onehop_create";
+ *summary = "Establishing one-hop circuit for dir info";
+ break;
case BOOTSTRAP_STATUS_REQUESTING_STATUS:
- return "Asking for networkstatus consensus";
+ *tag = "requesting_status";
+ *summary = "Asking for networkstatus consensus";
+ break;
case BOOTSTRAP_STATUS_LOADING_STATUS:
- return "Loading networkstatus consensus";
+ *tag = "loading_status";
+ *summary = "Loading networkstatus consensus";
+ break;
case BOOTSTRAP_STATUS_LOADING_KEYS:
- return "Loading authority key certs";
+ *tag = "loading_keys";
+ *summary = "Loading authority key certs";
+ break;
case BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS:
- return "Asking for relay descriptors";
+ *tag = "requesting_descriptors";
+ *summary = "Asking for relay descriptors";
+ break;
case BOOTSTRAP_STATUS_LOADING_DESCRIPTORS:
- return "Loading relay descriptors";
+ *tag = "loading_descriptors";
+ *summary = "Loading relay descriptors";
+ break;
case BOOTSTRAP_STATUS_CONN_OR:
- return "Connecting to entry guard";
+ *tag = "conn_or";
+ *summary = "Connecting to entry guard";
+ break;
case BOOTSTRAP_STATUS_HANDSHAKE_OR:
- return "Finishing handshake with entry guard";
+ *tag = "handshake_or";
+ *summary = "Finishing handshake with entry guard";
+ break;
case BOOTSTRAP_STATUS_CIRCUIT_CREATE:
- return "Establishing circuits";
+ *tag = "circuit_create";
+ *summary = "Establishing circuits";
+ break;
case BOOTSTRAP_STATUS_DONE:
- return "Done!";
+ *tag = "done";
+ *summary = "Done";
+ break;
default:
log_warn(LD_BUG, "Unrecognized bootstrap status code %d", s);
- return "unknown";
+ *tag = *summary = "unknown";
}
}
@@ -3872,6 +3901,7 @@ int
control_event_bootstrap(bootstrap_status_t status, int percent)
{
static int last_percent = 0;
+ const char *tag, *summary;
if (last_percent == 100)
return 0; /* already bootstrapped; nothing to be done here. */
@@ -3886,35 +3916,19 @@ control_event_bootstrap(bootstrap_status_t status, int percent)
}
}
-#if 0
- if (status <= last_percent)
- switch (status) {
- case BOOTSTRAP_STATUS_CONN_DIR:
- case BOOTSTRAP_STATUS_ONEHOP_CREATE:
- case BOOTSTRAP_STATUS_HANDSHAKE_DIR:
- case BOOTSTRAP_STATUS_REQUESTING_STATUS:
- case BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS:
- boring = 1;
- break;
- default: ;
- }
-
- if (!boring)
-#endif
if (status > last_percent || (percent && percent > last_percent)) {
+ bootstrap_status_to_string(status, &tag, &summary);
log_notice(LD_CONTROL, "Bootstrapped %d%%: %s.",
- percent ? percent : status,
- bootstrap_status_to_string(status));
+ percent ? percent : status, summary);
control_event_client_status(LOG_NOTICE,
- "BOOTSTRAP PROGRESS=%d SUMMARY=\"%s\"",
- percent ? percent : status,
- bootstrap_status_to_string(status));
+ "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\"",
+ percent ? percent : status, tag, summary);
}
- if (percent > last_percent) /* incremental progress within a milestone */
- last_percent = percent;
if (status > last_percent) /* new milestone reached */
last_percent = status ;
+ if (percent > last_percent) /* incremental progress within a milestone */
+ last_percent = percent;
return 0;
}