[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Rename and fix docs on FLUSH_ON_DISABLE
commit 2f28cd1dc8e797b140271e5c33b9e4f823f7f2d8
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Nov 14 13:42:09 2018 -0500
Rename and fix docs on FLUSH_ON_DISABLE
Also rename "...flush_and_disable()" to "...schedule_and_disable()"
---
src/core/mainloop/mainloop.c | 16 ++++++++--------
src/core/mainloop/periodic.c | 2 +-
src/core/mainloop/periodic.h | 6 +++---
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 2a68e8c09..9f45f3c86 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1386,7 +1386,7 @@ STATIC periodic_event_item_t periodic_events[] = {
/* This is a legacy catch-all callback that runs once per second if
* we are online and active. */
CALLBACK(second_elapsed, NET_PARTICIPANT,
- FL(NEED_NET)|FL(FLUSH_ON_DISABLE)),
+ FL(NEED_NET)|FL(RUN_ON_DISABLE)),
/* XXXX Do we have a reason to do this on a callback? Does it do any good at
* all? For now, if we're dormant, we can let our listeners decay. */
@@ -1401,9 +1401,9 @@ STATIC periodic_event_item_t periodic_events[] = {
/* We need to do these if we're participating in the Tor network, and
* immediately before we stop. */
- CALLBACK(clean_caches, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
- CALLBACK(save_state, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
- CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+ CALLBACK(clean_caches, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
+ CALLBACK(save_state, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
+ CALLBACK(write_stats_file, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
/* Routers (bridge and relay) only. */
CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
@@ -1436,7 +1436,7 @@ STATIC periodic_event_item_t periodic_events[] = {
/* Client only. */
/* XXXX this could be restricted to CLIENT+NET_PARTICIPANT */
- CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+ CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
/* Bridge Authority only. */
CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
@@ -1651,8 +1651,8 @@ rescan_periodic_events(const or_options_t *options)
periodic_event_enable(item);
} else {
log_debug(LD_GENERAL, "Disabling periodic event %s", item->name);
- if (item->flags & PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE) {
- periodic_event_flush_and_disable(item);
+ if (item->flags & PERIODIC_EVENT_FLAG_RUN_ON_DISABLE) {
+ periodic_event_schedule_and_disable(item);
} else {
periodic_event_disable(item);
}
@@ -1814,7 +1814,7 @@ second_elapsed_callback(time_t now, const or_options_t *options)
*/
/* (If our circuit build timeout can ever become lower than a second (which
* it can't, currently), we should do this more often.) */
- // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
+ // TODO: All expire stuff can become NET_PARTICIPANT, RUN_ON_DISABLE
circuit_expire_building();
circuit_expire_waiting_for_better_guard();
diff --git a/src/core/mainloop/periodic.c b/src/core/mainloop/periodic.c
index c290c3744..9f9b178e4 100644
--- a/src/core/mainloop/periodic.c
+++ b/src/core/mainloop/periodic.c
@@ -174,7 +174,7 @@ periodic_event_disable(periodic_event_item_t *event)
* Do nothing if the event was already disabled.
*/
void
-periodic_event_flush_and_disable(periodic_event_item_t *event)
+periodic_event_schedule_and_disable(periodic_event_item_t *event)
{
tor_assert(event);
if (!periodic_event_is_enabled(event))
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index 52d5450ee..05ba4297f 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -39,10 +39,10 @@
* the net_is_disabled() check. */
#define PERIODIC_EVENT_FLAG_NEED_NET (1U << 0)
-/* Indicate that it the event is enabled, it event needs to be run once before
+/* Indicate that if the event is enabled, it needs to be run once before
* it becomes disabled.
*/
-#define PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE (1U << 1)
+#define PERIODIC_EVENT_FLAG_RUN_ON_DISABLE (1U << 1)
/** Callback function for a periodic event to take action. The return value
* influences the next time the function will get called. Return
@@ -88,6 +88,6 @@ void periodic_event_destroy(periodic_event_item_t *event);
void periodic_event_reschedule(periodic_event_item_t *event);
void periodic_event_enable(periodic_event_item_t *event);
void periodic_event_disable(periodic_event_item_t *event);
-void periodic_event_flush_and_disable(periodic_event_item_t *event);
+void periodic_event_schedule_and_disable(periodic_event_item_t *event);
#endif /* !defined(TOR_PERIODIC_H) */
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits