commit 79a1112a495f76542d13eab4992ff4fd50f7f830 Author: David Goulet dgoulet@torproject.org Date: Tue Apr 24 15:28:47 2018 -0400
sr: Static inline functions if no dirauth module
Add static inline dirauth public functions used outside of the dirauth module so they can be seen by the tor code but simply do nothing.
Signed-off-by: David Goulet dgoulet@torproject.org --- src/or/dirauth/shared_random.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/or/dirauth/shared_random.h b/src/or/dirauth/shared_random.h index d1b2ac2e2..1778ce8f0 100644 --- a/src/or/dirauth/shared_random.h +++ b/src/or/dirauth/shared_random.h @@ -101,11 +101,40 @@ typedef struct sr_commit_t {
/* API */
-/* Public methods: */ +/* Public methods used _outside_ of the module. + * + * We need to nullify them if the module is disabled. */ +#ifdef HAVE_MODULE_DIRAUTH
int sr_init(int save_to_disk); void sr_save_and_cleanup(void); void sr_act_post_consensus(const networkstatus_t *consensus); + +#else /* HAVE_MODULE_DIRAUTH */ + +static inline int +sr_init(int save_to_disk) +{ + (void) save_to_disk; + /* Always return success. */ + return 0; +} + +static inline void +sr_save_and_cleanup(void) +{ +} + +static inline void +sr_act_post_consensus(const networkstatus_t *consensus) +{ + (void) consensus; +} + +#endif /* HAVE_MODULE_DIRAUTH */ + +/* Public methods used only by dirauth code. */ + void sr_handle_received_commits(smartlist_t *commits, crypto_pk_t *voter_key); sr_commit_t *sr_parse_commit(const smartlist_t *args);
tor-commits@lists.torproject.org