[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] relay: Disable relay_periodic when the relay module is disabled



commit 88c2a23c4b3954b321d2247ca3d66cff68e1912d
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Thu Nov 14 16:17:17 2019 +1000

    relay: Disable relay_periodic when the relay module is disabled
    
    Closes ticket 32244.
---
 changes/ticket32244                |  3 +++
 src/core/include.am                |  2 +-
 src/feature/relay/relay_periodic.h | 13 +++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/changes/ticket32244 b/changes/ticket32244
new file mode 100644
index 000000000..b3690b7d8
--- /dev/null
+++ b/changes/ticket32244
@@ -0,0 +1,3 @@
+  o Code simplification and refactoring:
+    - Disable relay_periodic when the relay module is disabled.
+      Closes ticket 32244.
diff --git a/src/core/include.am b/src/core/include.am
index 193b10a1c..5cafc4121 100644
--- a/src/core/include.am
+++ b/src/core/include.am
@@ -143,7 +143,6 @@ LIBTOR_APP_A_SOURCES = 				\
 	src/feature/relay/dns.c			\
 	src/feature/relay/ext_orport.c		\
 	src/feature/relay/onion_queue.c		\
-	src/feature/relay/relay_periodic.c	\
 	src/feature/relay/relay_sys.c		\
 	src/feature/relay/router.c		\
 	src/feature/relay/routerkeys.c		\
@@ -174,6 +173,7 @@ LIBTOR_APP_TESTING_A_SOURCES = $(LIBTOR_APP_A_SOURCES)
 MODULE_RELAY_SOURCES = 						\
 	src/feature/relay/routermode.c				\
 	src/feature/relay/relay_config.c			\
+	src/feature/relay/relay_periodic.c			\
 	src/feature/relay/transport_config.c
 
 # The Directory Authority module.
diff --git a/src/feature/relay/relay_periodic.h b/src/feature/relay/relay_periodic.h
index b6ea83c74..8da5b536a 100644
--- a/src/feature/relay/relay_periodic.h
+++ b/src/feature/relay/relay_periodic.h
@@ -12,7 +12,20 @@
 #ifndef TOR_FEATURE_RELAY_RELAY_PERIODIC_H
 #define TOR_FEATURE_RELAY_RELAY_PERIODIC_H
 
+#ifdef HAVE_MODULE_RELAY
+
 void relay_register_periodic_events(void);
 void reschedule_descriptor_update_check(void);
 
+#else
+
+#include "lib/cc/compat_compiler.h"
+
+#define relay_register_periodic_events() \
+  STMT_NIL
+#define reschedule_descriptor_update_check() \
+  STMT_NIL
+
+#endif
+
 #endif /* !defined(TOR_FEATURE_RELAY_RELAY_PERIODIC_H) */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits