summaryrefslogtreecommitdiff
path: root/src/or/control.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-07-30 10:43:37 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-18 08:55:28 -0400
commitbab221f1131e3c0552b3564ea72800d1d4a8facf (patch)
tree701c7002cf795291d0fc366cc5eb5f8b67fa931b /src/or/control.h
parent7b7cb0d779ee3ea9ff9e1cd8682662c3d0ce6813 (diff)
downloadtor-bab221f1131e3c0552b3564ea72800d1d4a8facf.tar.gz
tor-bab221f1131e3c0552b3564ea72800d1d4a8facf.zip
Refactor our logic for sending events to controllers
Previously we'd put these strings right on the controllers' outbufs. But this could cause some trouble, for these reasons: 1) Calling the network stack directly here would make a huge portion of our networking code (from which so much of the rest of Tor is reachable) reachable from everything that potentially generated controller events. 2) Since _some_ events (EVENT_ERR for instance) would cause us to call connection_flush(), every control_event_* function would appear to be able to reach even _more_ of the network stack in our cllgraph. 3) Every time we generated an event, we'd have to walk the whole connection list, which isn't exactly fast. This is an attempt to break down the "blob" described in http://archives.seul.org/tor/dev/Mar-2015/msg00197.html -- the set of functions from which nearly all the other functions in Tor are reachable. Closes ticket 16695.
Diffstat (limited to 'src/or/control.h')
-rw-r--r--src/or/control.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/control.h b/src/or/control.h
index 2d02443834..084030562a 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -78,6 +78,14 @@ int control_event_client_status(int severity, const char *format, ...)
CHECK_PRINTF(2,3);
int control_event_server_status(int severity, const char *format, ...)
CHECK_PRINTF(2,3);
+
+int control_event_general_error(const char *format, ...)
+ CHECK_PRINTF(1,2);
+int control_event_client_error(const char *format, ...)
+ CHECK_PRINTF(1,2);
+int control_event_server_error(const char *format, ...)
+ CHECK_PRINTF(1,2);
+
int control_event_guard(const char *nickname, const char *digest,
const char *status);
int control_event_conf_changed(const smartlist_t *elements);
@@ -215,6 +223,8 @@ typedef int event_format_t;
MOCK_DECL(STATIC void,
send_control_event_string,(uint16_t event, event_format_t which,
const char *msg));
+MOCK_DECL(STATIC void,
+ queue_control_event_string,(uint16_t event, char *msg));
void control_testing_set_global_event_mask(uint64_t mask);
#endif