summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-06-10 23:13:14 +0000
committerRoger Dingledine <arma@torproject.org>2008-06-10 23:13:14 +0000
commit15680ce8d23309a42643fa145088be21c11835d1 (patch)
tree44c29ccd51fd2e8bd3ed70577365c6e3116b054c
parent45cc25c0196aea33bfd207123cf2e128114dafd2 (diff)
downloadtor-15680ce8d23309a42643fa145088be21c11835d1.tar.gz
tor-15680ce8d23309a42643fa145088be21c11835d1.zip
some cleanups in preparation for moving stuff around
svn:r15112
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/control.c28
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/relay.c2
-rw-r--r--src/or/routerlist.c4
5 files changed, 21 insertions, 17 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 06d1dacd1c..2dae1868dd 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -236,7 +236,7 @@ connection_edge_end_errno(edge_connection_t *conn)
{
uint8_t reason;
tor_assert(conn);
- reason = (uint8_t)errno_to_end_reason(tor_socket_errno(conn->_base.s));
+ reason = (uint8_t)errno_to_end_stream_reason(tor_socket_errno(conn->_base.s));
return connection_edge_end(conn, reason);
}
diff --git a/src/or/control.c b/src/or/control.c
index 89f681979a..9b6c99cdd3 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3266,32 +3266,32 @@ control_tls_error_to_reason(int e)
}
/** Convert the reason for ending an OR connection <b>r</b> into the format
- * used in ORCONN events. Return NULL if the reason is unrecognized. */
+ * used in ORCONN events. Return "UNKNOWN" if the reason is unrecognized. */
static const char *
or_conn_end_reason_to_string(int r)
{
switch (r) {
case END_OR_CONN_REASON_DONE:
- return "REASON=DONE";
+ return "DONE";
case END_OR_CONN_REASON_TCP_REFUSED:
- return "REASON=CONNECTREFUSED";
+ return "CONNECTREFUSED";
case END_OR_CONN_REASON_OR_IDENTITY:
- return "REASON=IDENTITY";
+ return "IDENTITY";
case END_OR_CONN_REASON_TLS_CONNRESET:
- return "REASON=CONNECTRESET";
+ return "CONNECTRESET";
case END_OR_CONN_REASON_TLS_TIMEOUT:
- return "REASON=TIMEOUT";
+ return "TIMEOUT";
case END_OR_CONN_REASON_TLS_NO_ROUTE:
- return "REASON=NOROUTE";
+ return "NOROUTE";
case END_OR_CONN_REASON_TLS_IO_ERROR:
- return "REASON=IOERROR";
+ return "IOERROR";
case END_OR_CONN_REASON_TLS_MISC:
- return "REASON=MISC";
+ return "MISC";
case 0:
return "";
default:
log_warn(LD_BUG, "Unrecognized or_conn reason code %d", r);
- return "REASON=BOGUS";
+ return "UNKNOWN";
}
}
@@ -3333,15 +3333,17 @@ control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t tp,
if (EVENT_IS_INTERESTING1S(EVENT_OR_CONN_STATUS)) {
orconn_target_get_name(0, name, sizeof(name), conn);
send_control_event_extended(EVENT_OR_CONN_STATUS, SHORT_NAMES,
- "650 ORCONN %s %s@%s%s\r\n",
+ "650 ORCONN %s %s@%s%s%s\r\n",
name, status,
+ reason ? "REASON=" : "",
or_conn_end_reason_to_string(reason), ncircs_buf);
}
if (EVENT_IS_INTERESTING1L(EVENT_OR_CONN_STATUS)) {
orconn_target_get_name(1, name, sizeof(name), conn);
send_control_event_extended(EVENT_OR_CONN_STATUS, LONG_NAMES,
- "650 ORCONN %s %s@%s%s\r\n",
+ "650 ORCONN %s %s@%s%s%s\r\n",
name, status,
+ reason ? "REASON=" : "",
or_conn_end_reason_to_string(reason), ncircs_buf);
}
@@ -3976,7 +3978,7 @@ control_event_bootstrap_problem(const char *warn, int reason)
status, summary, warn,
or_conn_end_reason_to_string(reason));
control_event_client_status(LOG_WARN,
- "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" %s",
+ "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s",
bootstrap_percent, tag, summary, warn,
or_conn_end_reason_to_string(reason));
}
diff --git a/src/or/or.h b/src/or/or.h
index 271bef02a0..60454bb70d 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3605,7 +3605,7 @@ int connection_edge_package_raw_inbuf(edge_connection_t *conn,
int package_partial);
void connection_edge_consider_sending_sendme(edge_connection_t *conn);
socks5_reply_status_t connection_edge_end_reason_socks5_response(int reason);
-int errno_to_end_reason(int e);
+int errno_to_end_stream_reason(int e);
extern uint64_t stats_n_data_cells_packaged;
extern uint64_t stats_n_data_bytes_packaged;
diff --git a/src/or/relay.c b/src/or/relay.c
index 2fd557a0de..345308ab50 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -663,7 +663,7 @@ connection_edge_end_reason_socks5_response(int reason)
* appropriate for use in a RELAY END cell.
*/
int
-errno_to_end_reason(int e)
+errno_to_end_stream_reason(int e)
{
switch (e) {
case EPIPE:
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f63e34beef..e7bde691bf 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -4251,7 +4251,9 @@ count_usable_descriptors(int *num_present, int *num_usable,
log_debug(LD_DIR, "%d usable, %d present.", *num_usable, *num_present);
}
-/* XXXX021 should this be static? */
+/** We just fetched a new set of descriptors. Compute how far through
+ * the "loading descriptors" bootstrapping phase we are, so we can inform
+ * the controller of our progress. */
int
count_loading_descriptors_progress(void)
{