Merge ocirc and orconn events into or subsystem.

Pubsub events are not supposed to have their own subsystems; they're
supposed to be part of a parent subsystem.
This commit is contained in:
Nick Mathewson
2020-02-14 09:34:51 -05:00
parent 2e5d555c0e
commit 63b7dabdea
8 changed files with 20 additions and 49 deletions
-4
View File
@@ -14,9 +14,7 @@
#include "lib/cc/torint.h"
#include "core/mainloop/mainloop_sys.h"
#include "core/or/ocirc_event_sys.h"
#include "core/or/or_sys.h"
#include "core/or/orconn_event_sys.h"
#include "feature/control/btrack_sys.h"
#include "lib/compress/compress_sys.h"
#include "lib/crypt_ops/crypto_sys.h"
@@ -61,8 +59,6 @@ const subsys_fns_t *tor_subsystems[] = {
&sys_mainloop,
&sys_or,
&sys_orconn_event,
&sys_ocirc_event,
&sys_relay,
-2
View File
@@ -74,13 +74,11 @@ noinst_HEADERS += \
src/core/or/or_periodic.h \
src/core/or/or_sys.h \
src/core/or/orconn_event.h \
src/core/or/orconn_event_sys.h \
src/core/or/or_circuit_st.h \
src/core/or/or_connection_st.h \
src/core/or/or_handshake_certs_st.h \
src/core/or/or_handshake_state_st.h \
src/core/or/ocirc_event.h \
src/core/or/ocirc_event_sys.h \
src/core/or/origin_circuit_st.h \
src/core/or/policies.h \
src/core/or/port_cfg_st.h \
+2 -9
View File
@@ -22,7 +22,7 @@
#include "core/or/cpath_build_state_st.h"
#include "core/or/ocirc_event.h"
#include "core/or/ocirc_event_sys.h"
#include "core/or/or_sys.h"
#include "core/or/origin_circuit_st.h"
#include "lib/subsys/subsys.h"
@@ -84,7 +84,7 @@ static dispatch_typefns_t ocirc_cevent_fns = {
.fmt_fn = ocirc_cevent_fmt,
};
static int
int
ocirc_add_pubsub(struct pubsub_connector_t *connector)
{
if (DISPATCH_REGISTER_TYPE(connector, ocirc_state, &ocirc_state_fns))
@@ -119,10 +119,3 @@ ocirc_cevent_publish(ocirc_cevent_msg_t *msg)
{
PUBLISH(ocirc_cevent, msg);
}
const subsys_fns_t sys_ocirc_event = {
.name = "ocirc_event",
.supported = true,
.level = 22,
.add_pubsub = ocirc_add_pubsub,
};
-13
View File
@@ -1,13 +0,0 @@
/* Copyright (c) 2007-2020, The Tor Project, Inc. */
/**
* \file ocirc_event_sys.h
* \brief Declare subsystem object for the origin circuit event module.
**/
#ifndef TOR_OCIRC_EVENT_SYS_H
#define TOR_OCIRC_EVENT_SYS_H
extern const struct subsys_fns_t sys_ocirc_event;
#endif /* !defined(TOR_OCIRC_EVENT_SYS_H) */
+12
View File
@@ -34,10 +34,22 @@ subsys_or_shutdown(void)
policies_free_all();
}
static int
subsys_or_add_pubsub(struct pubsub_connector_t *connector)
{
int rv = 0;
if (orconn_add_pubsub(connector) < 0)
rv = -1;
if (ocirc_add_pubsub(connector) < 0)
rv = -1;
return rv;
}
const struct subsys_fns_t sys_or = {
.name = "or",
.supported = true,
.level = 20,
.initialize = subsys_or_initialize,
.shutdown = subsys_or_shutdown,
.add_pubsub = subsys_or_add_pubsub,
};
+4
View File
@@ -14,4 +14,8 @@
extern const struct subsys_fns_t sys_or;
struct pubsub_connector_t;
int ocirc_add_pubsub(struct pubsub_connector_t *connector);
int orconn_add_pubsub(struct pubsub_connector_t *connector);
#endif /* !defined(TOR_CORE_OR_OR_SYS_H) */
+2 -9
View File
@@ -22,7 +22,7 @@
#define ORCONN_EVENT_PRIVATE
#include "core/or/orconn_event.h"
#include "core/or/orconn_event_sys.h"
#include "core/or/or_sys.h"
DECLARE_PUBLISH(orconn_state);
DECLARE_PUBLISH(orconn_status);
@@ -65,7 +65,7 @@ static dispatch_typefns_t orconn_status_fns = {
.fmt_fn = orconn_status_fmt,
};
static int
int
orconn_add_pubsub(struct pubsub_connector_t *connector)
{
if (DISPATCH_REGISTER_TYPE(connector, orconn_state, &orconn_state_fns))
@@ -90,10 +90,3 @@ orconn_status_publish(orconn_status_msg_t *msg)
{
PUBLISH(orconn_status, msg);
}
const subsys_fns_t sys_orconn_event = {
.name = "orconn_event",
.supported = true,
.level = 22,
.add_pubsub = orconn_add_pubsub,
};
-12
View File
@@ -1,12 +0,0 @@
/* Copyright (c) 2007-2020, The Tor Project, Inc. */
/**
* \file orconn_event_sys.h
* \brief Declare subsystem object for the OR connection event module.
**/
#ifndef TOR_ORCONN_EVENT_SYS_H
#define TOR_ORCONN_EVENT_SYS_H
extern const struct subsys_fns_t sys_orconn_event;
#endif /* !defined(TOR_ORCONN_EVENT_SYS_H) */