[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15112: some cleanups in preparation for moving stuff around (tor/trunk/src/or)



Author: arma
Date: 2008-06-10 19:13:14 -0400 (Tue, 10 Jun 2008)
New Revision: 15112

Modified:
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/control.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/relay.c
   tor/trunk/src/or/routerlist.c
Log:
some cleanups in preparation for moving stuff around


Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2008-06-10 23:00:11 UTC (rev 15111)
+++ tor/trunk/src/or/connection_edge.c	2008-06-10 23:13:14 UTC (rev 15112)
@@ -236,7 +236,7 @@
 {
   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);
 }
 

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-06-10 23:00:11 UTC (rev 15111)
+++ tor/trunk/src/or/control.c	2008-06-10 23:13:14 UTC (rev 15112)
@@ -3266,32 +3266,32 @@
 }
 
 /** 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 @@
   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 @@
            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));
 }

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-06-10 23:00:11 UTC (rev 15111)
+++ tor/trunk/src/or/or.h	2008-06-10 23:13:14 UTC (rev 15112)
@@ -3605,7 +3605,7 @@
                                       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;

Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c	2008-06-10 23:00:11 UTC (rev 15111)
+++ tor/trunk/src/or/relay.c	2008-06-10 23:13:14 UTC (rev 15112)
@@ -663,7 +663,7 @@
  * 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:

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-06-10 23:00:11 UTC (rev 15111)
+++ tor/trunk/src/or/routerlist.c	2008-06-10 23:13:14 UTC (rev 15112)
@@ -4251,7 +4251,9 @@
   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)
 {