[tor-commits] [tor/master] Code simplifications for AP_CONN_STATE_CONTROLLER_WAIT

nickm at torproject.org nickm at torproject.org
Mon Aug 3 12:34:58 UTC 2020


commit 837e0c4dc93bd035298551c35db5be2ed18ee5dc
Author: Neel Chauhan <neel at neelc.org>
Date:   Fri Jul 31 09:21:43 2020 -0700

    Code simplifications for AP_CONN_STATE_CONTROLLER_WAIT
---
 src/core/or/connection_edge.c        |  2 +-
 src/feature/control/control_events.c | 10 +---------
 src/feature/control/control_events.h |  3 ++-
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 5fc5f1176a..6c02d6b122 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -1511,7 +1511,7 @@ connection_entry_set_controller_wait(entry_connection_t *conn)
 {
   CONNECTION_AP_EXPECT_NONPENDING(conn);
   ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_CONTROLLER_WAIT;
-  control_event_enter_controller_wait();
+  control_event_stream_status(conn, STREAM_EVENT_CONTROLLER_WAIT, 0);
 }
 
 /** The AP connection <b>conn</b> has just failed while attaching or
diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c
index 85936aa722..f97130d020 100644
--- a/src/feature/control/control_events.c
+++ b/src/feature/control/control_events.c
@@ -819,6 +819,7 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
     case STREAM_EVENT_NEW_RESOLVE: status = "NEWRESOLVE"; break;
     case STREAM_EVENT_FAILED_RETRIABLE: status = "DETACHED"; break;
     case STREAM_EVENT_REMAP: status = "REMAP"; break;
+    case STREAM_EVENT_CONTROLLER_WAIT: status = "CONTROLLER_WAIT"; break;
     default:
       log_warn(LD_BUG, "Unrecognized status code %d", (int)tp);
       return 0;
@@ -2364,15 +2365,6 @@ control_events_free_all(void)
   disable_log_messages = 0;
 }
 
-/** Our own router descriptor has changed; tell any controllers that care.
- */
-int
-control_event_enter_controller_wait(void)
-{
-  send_control_event(EVENT_CONTROLLER_WAIT, "650 CONTROLLER_WAIT\r\n");
-  return 0;
-}
-
 #ifdef TOR_UNIT_TESTS
 /* For testing: change the value of global_event_mask */
 void
diff --git a/src/feature/control/control_events.h b/src/feature/control/control_events.h
index cd84fb0850..82c665ac71 100644
--- a/src/feature/control/control_events.h
+++ b/src/feature/control/control_events.h
@@ -36,7 +36,8 @@ typedef enum stream_status_event_t {
   STREAM_EVENT_NEW          = 5,
   STREAM_EVENT_NEW_RESOLVE  = 6,
   STREAM_EVENT_FAILED_RETRIABLE = 7,
-  STREAM_EVENT_REMAP        = 8
+  STREAM_EVENT_REMAP        = 8,
+  STREAM_EVENT_CONTROLLER_WAIT = 9
 } stream_status_event_t;
 
 /** Used to indicate the type of a buildtime event */





More information about the tor-commits mailing list