[tor-commits] [tor/master] Merge branch 'tor-github/pr/1040'

dgoulet at torproject.org dgoulet at torproject.org
Tue Jun 11 16:06:55 UTC 2019


commit f7e8b3b68c8e2cecfc7ff4072e9f00d316aaba4f
Merge: 8e112cecd 5f5f6bb8f
Author: David Goulet <dgoulet at torproject.org>
Date:   Tue Jun 11 11:59:39 2019 -0400

    Merge branch 'tor-github/pr/1040'

 changes/ticket29976                  |   3 +
 src/app/main/main.c                  |   2 +
 src/core/or/circuitbuild.c           |  11 ++--
 src/core/or/circuitlist.c            |  33 +++++------
 src/core/or/connection_or.c          |  28 ++++-----
 src/core/or/ocirc_event.c            | 112 ++++++++++++++++++++++++-----------
 src/core/or/ocirc_event.h            |  35 +++--------
 src/core/or/orconn_event.c           |  90 +++++++++++++++++-----------
 src/core/or/orconn_event.h           |  31 +++-------
 src/feature/control/btrack.c         |  15 ++++-
 src/feature/control/btrack_circuit.c |  52 ++++++++--------
 src/feature/control/btrack_circuit.h |   3 +
 src/feature/control/btrack_orconn.c  |  68 ++++++++++-----------
 src/feature/control/btrack_orconn.h  |   3 +
 src/lib/pubsub/pubsub_check.c        |  26 ++------
 src/test/test_btrack.c               |  89 ++++++++++++++++++----------
 src/test/test_circuitstats.c         |   2 +-
 src/test/test_controller_events.c    |  62 ++++++++++---------
 src/test/test_extorport.c            |   2 +-
 src/test/test_helpers.c              |  56 ++++++++++++++++++
 src/test/test_helpers.h              |   6 ++
 src/test/test_pubsub_build.c         |  43 --------------
 22 files changed, 427 insertions(+), 345 deletions(-)

diff --cc src/core/or/ocirc_event.h
index 59ec9e27c,ad6d69ffb..8e9494874
--- a/src/core/or/ocirc_event.h
+++ b/src/core/or/ocirc_event.h
@@@ -56,34 -61,12 +61,12 @@@ typedef struct ocirc_cevent_msg_t 
    bool onehop;                  /**< one-hop circuit? */
  } ocirc_cevent_msg_t;
  
- /** Discriminant values for origin circuit event message */
- typedef enum ocirc_msgtype_t {
-   OCIRC_MSGTYPE_STATE,
-   OCIRC_MSGTYPE_CHAN,
-   OCIRC_MSGTYPE_CEVENT,
- } ocirc_msgtype_t;
- 
- /** Discriminated union for the actual message */
- typedef struct ocirc_event_msg_t {
-   int type;
-   union {
-     ocirc_state_msg_t state;
-     ocirc_chan_msg_t chan;
-     ocirc_cevent_msg_t cevent;
-   } u;
- } ocirc_event_msg_t;
- 
- /**
-  * Receiver function pointer for origin circuit subscribers
-  *
-  * This function gets called synchronously by the publisher.
-  **/
- typedef void (*ocirc_event_rcvr_t)(const ocirc_event_msg_t *);
- 
- void ocirc_event_subscribe(ocirc_event_rcvr_t fn);
+ DECLARE_MESSAGE(ocirc_cevent, ocirc_cevent, ocirc_cevent_msg_t *);
  
  #ifdef OCIRC_EVENT_PRIVATE
- void ocirc_event_publish(const ocirc_event_msg_t *msg);
+ void ocirc_state_publish(ocirc_state_msg_t *msg);
+ void ocirc_chan_publish(ocirc_chan_msg_t *msg);
+ void ocirc_cevent_publish(ocirc_cevent_msg_t *msg);
  #endif
  
 -#endif  /* defined(TOR_OCIRC_EVENT_STATE_H) */
 +#endif /* !defined(TOR_OCIRC_EVENT_H) */
diff --cc src/core/or/orconn_event.h
index d6635793d,a3b37d2c3..fb67a7d18
--- a/src/core/or/orconn_event.h
+++ b/src/core/or/orconn_event.h
@@@ -95,26 -93,11 +93,11 @@@ typedef struct orconn_status_msg_t 
    int reason;                   /**< reason */
  } orconn_status_msg_t;
  
- /** Discriminated union for the actual message */
- typedef struct orconn_event_msg_t {
-   int type;
-   union {
-     orconn_state_msg_t state;
-     orconn_status_msg_t status;
-   } u;
- } orconn_event_msg_t;
- 
- /**
-  * Receiver function pointer for OR subscribers
-  *
-  * This function gets called synchronously by the publisher.
-  **/
- typedef void (*orconn_event_rcvr_t)(const orconn_event_msg_t *);
- 
- void orconn_event_subscribe(orconn_event_rcvr_t);
+ DECLARE_MESSAGE(orconn_status, orconn_status, orconn_status_msg_t *);
  
  #ifdef ORCONN_EVENT_PRIVATE
- void orconn_event_publish(const orconn_event_msg_t *);
+ void orconn_state_publish(orconn_state_msg_t *);
+ void orconn_status_publish(orconn_status_msg_t *);
  #endif
  
 -#endif  /* defined(TOR_ORCONN_EVENT_H) */
 +#endif /* !defined(TOR_ORCONN_EVENT_H) */
diff --cc src/feature/control/btrack_circuit.h
index 9e06fefb0,b2ae6484f..b326c22cc
--- a/src/feature/control/btrack_circuit.h
+++ b/src/feature/control/btrack_circuit.h
@@@ -9,7 -9,10 +9,10 @@@
  #ifndef TOR_BTRACK_CIRCUIT_H
  #define TOR_BTRACK_CIRCUIT_H
  
+ #include "lib/pubsub/pubsub.h"
+ 
  int btrack_circ_init(void);
  void btrack_circ_fini(void);
+ int btrack_circ_add_pubsub(pubsub_connector_t *);
  
 -#endif  /* defined(TOR_BTRACK_CIRCUIT_H) */
 +#endif /* !defined(TOR_BTRACK_CIRCUIT_H) */
diff --cc src/feature/control/btrack_orconn.h
index f8f5c1096,fed9a58eb..07b1b755f
--- a/src/feature/control/btrack_orconn.h
+++ b/src/feature/control/btrack_orconn.h
@@@ -30,9 -32,10 +32,10 @@@ typedef struct bt_orconn_t 
    bool is_onehop;           /**< Is this for a one-hop circuit? */
  } bt_orconn_t;
  
 -#endif  /* defined(BTRACK_ORCONN_PRIVATE) */
 +#endif /* defined(BTRACK_ORCONN_PRIVATE) */
  
  int btrack_orconn_init(void);
+ int btrack_orconn_add_pubsub(pubsub_connector_t *);
  void btrack_orconn_fini(void);
  
 -#endif  /* defined(TOR_BTRACK_ORCONN_H) */
 +#endif /* !defined(TOR_BTRACK_ORCONN_H) */



More information about the tor-commits mailing list