|
@@ -2731,12 +2731,14 @@ get_detached_signatures_from_pending_consensuses(pending_consensus_t *pending,
|
|
|
|
|
|
/**
|
|
|
* Entry point: Take whatever voting actions are pending as of <b>now</b>.
|
|
|
+ *
|
|
|
+ * Return the time at which the next action should be taken.
|
|
|
*/
|
|
|
-void
|
|
|
+time_t
|
|
|
dirvote_act(const or_options_t *options, time_t now)
|
|
|
{
|
|
|
if (!authdir_mode_v3(options))
|
|
|
- return;
|
|
|
+ return TIME_MAX;
|
|
|
tor_assert_nonfatal(voting_schedule.voting_starts);
|
|
|
/* If we haven't initialized this object through this codeflow, we need to
|
|
|
* recalculate the timings to match our vote. The reason to do that is if we
|
|
@@ -2754,8 +2756,13 @@ dirvote_act(const or_options_t *options, time_t now)
|
|
|
}
|
|
|
|
|
|
#define IF_TIME_FOR_NEXT_ACTION(when_field, done_field) \
|
|
|
- if (voting_schedule.when_field < now && !voting_schedule.done_field) do {
|
|
|
-#define ENDIF } while(0);
|
|
|
+ if (! voting_schedule.done_field) { \
|
|
|
+ if (voting_schedule.when_field > now) { \
|
|
|
+ return voting_schedule.when_field; \
|
|
|
+ } else {
|
|
|
+#define ENDIF \
|
|
|
+ } \
|
|
|
+ }
|
|
|
|
|
|
IF_TIME_FOR_NEXT_ACTION(voting_starts, have_voted) {
|
|
|
log_notice(LD_DIR, "Time to vote.");
|
|
@@ -2792,8 +2799,12 @@ dirvote_act(const or_options_t *options, time_t now)
|
|
|
/* XXXX We will want to try again later if we haven't got enough
|
|
|
* signatures yet. Implement this if it turns out to ever happen. */
|
|
|
dirvote_recalculate_timing(options, now);
|
|
|
+ return voting_schedule.voting_starts;
|
|
|
} ENDIF
|
|
|
|
|
|
+ tor_assert_nonfatal_unreached();
|
|
|
+ return now + 1;
|
|
|
+
|
|
|
#undef ENDIF
|
|
|
#undef IF_TIME_FOR_NEXT_ACTION
|
|
|
}
|