mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 22:53:44 +01:00
Rename voting_schedule_*() functions.
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ voting_schedule_recalculate_timing dirauth_sched_recalculate_timing \ voting_schedule_get_start_of_next_interval voting_sched_get_start_of_interval_after \ voting_schedule_get_next_valid_after_time dirauth_sched_get_next_valid_after_time
This commit is contained in:
parent
b7ba558f56
commit
4fb6d8675f
@ -305,7 +305,7 @@ options_act_dirauth(const or_options_t *old_options)
|
|||||||
/* We may need to reschedule some dirauth stuff if our status changed. */
|
/* We may need to reschedule some dirauth stuff if our status changed. */
|
||||||
if (old_options) {
|
if (old_options) {
|
||||||
if (options_transition_affects_dirauth_timing(old_options, options)) {
|
if (options_transition_affects_dirauth_timing(old_options, options)) {
|
||||||
voting_schedule_recalculate_timing(options, time(NULL));
|
dirauth_sched_recalculate_timing(options, time(NULL));
|
||||||
reschedule_dirvote(options);
|
reschedule_dirvote(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2850,7 +2850,7 @@ dirvote_act(const or_options_t *options, time_t now)
|
|||||||
"Mine is %s.",
|
"Mine is %s.",
|
||||||
keys, hex_str(c->cache_info.identity_digest, DIGEST_LEN));
|
keys, hex_str(c->cache_info.identity_digest, DIGEST_LEN));
|
||||||
tor_free(keys);
|
tor_free(keys);
|
||||||
voting_schedule_recalculate_timing(options, now);
|
dirauth_sched_recalculate_timing(options, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IF_TIME_FOR_NEXT_ACTION(when_field, done_field) \
|
#define IF_TIME_FOR_NEXT_ACTION(when_field, done_field) \
|
||||||
@ -2896,7 +2896,7 @@ dirvote_act(const or_options_t *options, time_t now)
|
|||||||
networkstatus_get_latest_consensus_by_flavor(FLAV_NS));
|
networkstatus_get_latest_consensus_by_flavor(FLAV_NS));
|
||||||
/* XXXX We will want to try again later if we haven't got enough
|
/* 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. */
|
* signatures yet. Implement this if it turns out to ever happen. */
|
||||||
voting_schedule_recalculate_timing(options, now);
|
dirauth_sched_recalculate_timing(options, now);
|
||||||
return voting_schedule.voting_starts;
|
return voting_schedule.voting_starts;
|
||||||
} ENDIF
|
} ENDIF
|
||||||
|
|
||||||
@ -4628,7 +4628,7 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
|
|||||||
else
|
else
|
||||||
last_consensus_interval = options->TestingV3AuthInitialVotingInterval;
|
last_consensus_interval = options->TestingV3AuthInitialVotingInterval;
|
||||||
v3_out->valid_after =
|
v3_out->valid_after =
|
||||||
voting_schedule_get_start_of_next_interval(now,
|
voting_sched_get_start_of_interval_after(now,
|
||||||
(int)last_consensus_interval,
|
(int)last_consensus_interval,
|
||||||
options->TestingV3AuthVotingStartOffset);
|
options->TestingV3AuthVotingStartOffset);
|
||||||
format_iso_time(tbuf, v3_out->valid_after);
|
format_iso_time(tbuf, v3_out->valid_after);
|
||||||
|
@ -1261,7 +1261,7 @@ sr_act_post_consensus(const networkstatus_t *consensus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare our state so that it's ready for the next voting period. */
|
/* Prepare our state so that it's ready for the next voting period. */
|
||||||
sr_state_update(voting_schedule_get_next_valid_after_time());
|
sr_state_update(dirauth_sched_get_next_valid_after_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize shared random subsystem. This MUST be called early in the boot
|
/** Initialize shared random subsystem. This MUST be called early in the boot
|
||||||
|
@ -1330,7 +1330,7 @@ sr_state_init(int save_to_disk, int read_from_disk)
|
|||||||
/* We have a state in memory, let's make sure it's updated for the current
|
/* We have a state in memory, let's make sure it's updated for the current
|
||||||
* and next voting round. */
|
* and next voting round. */
|
||||||
{
|
{
|
||||||
time_t valid_after = voting_schedule_get_next_valid_after_time();
|
time_t valid_after = dirauth_sched_get_next_valid_after_time();
|
||||||
sr_state_update(valid_after);
|
sr_state_update(valid_after);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -56,9 +56,9 @@ get_voting_schedule(const or_options_t *options, time_t now, int severity)
|
|||||||
vote_delay = dist_delay = interval / 4;
|
vote_delay = dist_delay = interval / 4;
|
||||||
|
|
||||||
start = new_voting_schedule->interval_starts =
|
start = new_voting_schedule->interval_starts =
|
||||||
voting_schedule_get_start_of_next_interval(now,interval,
|
voting_sched_get_start_of_interval_after(now,interval,
|
||||||
options->TestingV3AuthVotingStartOffset);
|
options->TestingV3AuthVotingStartOffset);
|
||||||
end = voting_schedule_get_start_of_next_interval(start+1, interval,
|
end = voting_sched_get_start_of_interval_after(start+1, interval,
|
||||||
options->TestingV3AuthVotingStartOffset);
|
options->TestingV3AuthVotingStartOffset);
|
||||||
|
|
||||||
tor_assert(end > start);
|
tor_assert(end > start);
|
||||||
@ -97,7 +97,7 @@ voting_schedule_t voting_schedule;
|
|||||||
|
|
||||||
/* Using the time <b>now</b>, return the next voting valid-after time. */
|
/* Using the time <b>now</b>, return the next voting valid-after time. */
|
||||||
time_t
|
time_t
|
||||||
voting_schedule_get_next_valid_after_time(void)
|
dirauth_sched_get_next_valid_after_time(void)
|
||||||
{
|
{
|
||||||
time_t now = approx_time();
|
time_t now = approx_time();
|
||||||
bool need_to_recalculate_voting_schedule = false;
|
bool need_to_recalculate_voting_schedule = false;
|
||||||
@ -123,7 +123,7 @@ voting_schedule_get_next_valid_after_time(void)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
if (need_to_recalculate_voting_schedule) {
|
if (need_to_recalculate_voting_schedule) {
|
||||||
voting_schedule_recalculate_timing(get_options(), approx_time());
|
dirauth_sched_recalculate_timing(get_options(), approx_time());
|
||||||
voting_schedule.created_on_demand = 1;
|
voting_schedule.created_on_demand = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ voting_schedule_get_next_valid_after_time(void)
|
|||||||
* doing. All type of tor do that because HS subsystem needs the timing as
|
* doing. All type of tor do that because HS subsystem needs the timing as
|
||||||
* well to function properly. */
|
* well to function properly. */
|
||||||
void
|
void
|
||||||
voting_schedule_recalculate_timing(const or_options_t *options, time_t now)
|
dirauth_sched_recalculate_timing(const or_options_t *options, time_t now)
|
||||||
{
|
{
|
||||||
voting_schedule_t *new_voting_schedule;
|
voting_schedule_t *new_voting_schedule;
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ typedef struct {
|
|||||||
|
|
||||||
extern voting_schedule_t voting_schedule;
|
extern voting_schedule_t voting_schedule;
|
||||||
|
|
||||||
void voting_schedule_recalculate_timing(const or_options_t *options,
|
void dirauth_sched_recalculate_timing(const or_options_t *options,
|
||||||
time_t now);
|
time_t now);
|
||||||
|
|
||||||
time_t voting_schedule_get_next_valid_after_time(void);
|
time_t dirauth_sched_get_next_valid_after_time(void);
|
||||||
|
|
||||||
#endif /* !defined(TOR_VOTING_SCHEDULE_H) */
|
#endif /* !defined(TOR_VOTING_SCHEDULE_H) */
|
||||||
|
@ -63,10 +63,10 @@ get_start_time_of_current_round(void)
|
|||||||
const or_options_t *options = get_options();
|
const or_options_t *options = get_options();
|
||||||
int voting_interval = get_voting_interval();
|
int voting_interval = get_voting_interval();
|
||||||
/* First, get the start time of the next round */
|
/* First, get the start time of the next round */
|
||||||
time_t next_start = voting_schedule_get_next_valid_after_time();
|
time_t next_start = dirauth_sched_get_next_valid_after_time();
|
||||||
/* Now roll back next_start by a voting interval to find the start time of
|
/* Now roll back next_start by a voting interval to find the start time of
|
||||||
the current round. */
|
the current round. */
|
||||||
time_t curr_start = voting_schedule_get_start_of_next_interval(
|
time_t curr_start = voting_sched_get_start_of_interval_after(
|
||||||
next_start - voting_interval - 1,
|
next_start - voting_interval - 1,
|
||||||
voting_interval,
|
voting_interval,
|
||||||
options->TestingV3AuthVotingStartOffset);
|
options->TestingV3AuthVotingStartOffset);
|
||||||
|
@ -2120,7 +2120,7 @@ networkstatus_set_current_consensus(const char *consensus,
|
|||||||
* the first thing we need to do is recalculate the voting schedule static
|
* the first thing we need to do is recalculate the voting schedule static
|
||||||
* object so we can use the timings in there needed by some subsystems
|
* object so we can use the timings in there needed by some subsystems
|
||||||
* such as hidden service and shared random. */
|
* such as hidden service and shared random. */
|
||||||
voting_schedule_recalculate_timing(options, now);
|
dirauth_sched_recalculate_timing(options, now);
|
||||||
reschedule_dirvote(options);
|
reschedule_dirvote(options);
|
||||||
|
|
||||||
nodelist_set_consensus(c);
|
nodelist_set_consensus(c);
|
||||||
@ -2772,7 +2772,7 @@ networkstatus_free_all(void)
|
|||||||
* truncated to less than half its size, it is rolled into the
|
* truncated to less than half its size, it is rolled into the
|
||||||
* previous interval. */
|
* previous interval. */
|
||||||
time_t
|
time_t
|
||||||
voting_schedule_get_start_of_next_interval(time_t now, int interval,
|
voting_sched_get_start_of_interval_after(time_t now, int interval,
|
||||||
int offset)
|
int offset)
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
@ -153,7 +153,7 @@ void vote_routerstatus_free_(vote_routerstatus_t *rs);
|
|||||||
void set_routerstatus_from_routerinfo(routerstatus_t *rs,
|
void set_routerstatus_from_routerinfo(routerstatus_t *rs,
|
||||||
const node_t *node,
|
const node_t *node,
|
||||||
const routerinfo_t *ri);
|
const routerinfo_t *ri);
|
||||||
time_t voting_schedule_get_start_of_next_interval(time_t now,
|
time_t voting_sched_get_start_of_interval_after(time_t now,
|
||||||
int interval,
|
int interval,
|
||||||
int offset);
|
int offset);
|
||||||
|
|
||||||
|
@ -3610,7 +3610,7 @@ test_a_networkstatus(
|
|||||||
sign_skey_2 = crypto_pk_new();
|
sign_skey_2 = crypto_pk_new();
|
||||||
sign_skey_3 = crypto_pk_new();
|
sign_skey_3 = crypto_pk_new();
|
||||||
sign_skey_leg1 = pk_generate(4);
|
sign_skey_leg1 = pk_generate(4);
|
||||||
voting_schedule_recalculate_timing(get_options(), now);
|
dirauth_sched_recalculate_timing(get_options(), now);
|
||||||
sr_state_init(0, 0);
|
sr_state_init(0, 0);
|
||||||
|
|
||||||
tt_assert(!crypto_pk_read_private_key_from_string(sign_skey_1,
|
tt_assert(!crypto_pk_read_private_key_from_string(sign_skey_1,
|
||||||
|
@ -2080,7 +2080,7 @@ test_dir_handle_get_status_vote_d(void* data)
|
|||||||
mock_options->TestingV3AuthInitialDistDelay = 1;
|
mock_options->TestingV3AuthInitialDistDelay = 1;
|
||||||
|
|
||||||
time_t now = 1441223455 -1;
|
time_t now = 1441223455 -1;
|
||||||
voting_schedule_recalculate_timing(mock_options, now);
|
dirauth_sched_recalculate_timing(mock_options, now);
|
||||||
|
|
||||||
const char *msg_out = NULL;
|
const char *msg_out = NULL;
|
||||||
int status_out = 0;
|
int status_out = 0;
|
||||||
@ -2457,7 +2457,7 @@ test_dir_handle_get_status_vote_next_authority(void* data)
|
|||||||
mock_options->TestingV3AuthInitialDistDelay = 1;
|
mock_options->TestingV3AuthInitialDistDelay = 1;
|
||||||
|
|
||||||
time_t now = 1441223455 -1;
|
time_t now = 1441223455 -1;
|
||||||
voting_schedule_recalculate_timing(mock_options, now);
|
dirauth_sched_recalculate_timing(mock_options, now);
|
||||||
|
|
||||||
struct pending_vote_t *vote = dirvote_add_vote(VOTE_BODY_V3, 0,
|
struct pending_vote_t *vote = dirvote_add_vote(VOTE_BODY_V3, 0,
|
||||||
&msg_out, &status_out);
|
&msg_out, &status_out);
|
||||||
@ -2617,7 +2617,7 @@ test_dir_handle_get_status_vote_current_authority(void* data)
|
|||||||
mock_options->TestingV3AuthInitialDistDelay = 1;
|
mock_options->TestingV3AuthInitialDistDelay = 1;
|
||||||
|
|
||||||
time_t now = 1441223455;
|
time_t now = 1441223455;
|
||||||
voting_schedule_recalculate_timing(mock_options, now-1);
|
dirauth_sched_recalculate_timing(mock_options, now-1);
|
||||||
|
|
||||||
struct pending_vote_t *vote = dirvote_add_vote(VOTE_BODY_V3, 0,
|
struct pending_vote_t *vote = dirvote_add_vote(VOTE_BODY_V3, 0,
|
||||||
&msg_out, &status_out);
|
&msg_out, &status_out);
|
||||||
@ -2737,7 +2737,7 @@ test_dir_handle_get_status_vote_too_late(void* data)
|
|||||||
mock_options->TestingV3AuthInitialDistDelay = base_delay;
|
mock_options->TestingV3AuthInitialDistDelay = base_delay;
|
||||||
|
|
||||||
time_t now = 1441223455;
|
time_t now = 1441223455;
|
||||||
voting_schedule_recalculate_timing(mock_options, now-1);
|
dirauth_sched_recalculate_timing(mock_options, now-1);
|
||||||
const time_t voting_starts = voting_schedule.voting_starts;
|
const time_t voting_starts = voting_schedule.voting_starts;
|
||||||
const time_t fetch_missing = voting_schedule.fetch_missing_votes;
|
const time_t fetch_missing = voting_schedule.fetch_missing_votes;
|
||||||
|
|
||||||
@ -2770,7 +2770,7 @@ test_dir_handle_get_status_vote_too_late(void* data)
|
|||||||
/* Move the pending vote to previous vote */
|
/* Move the pending vote to previous vote */
|
||||||
dirvote_act(mock_options, now+1);
|
dirvote_act(mock_options, now+1);
|
||||||
/* And reset the timing */
|
/* And reset the timing */
|
||||||
voting_schedule_recalculate_timing(mock_options, now-1);
|
dirauth_sched_recalculate_timing(mock_options, now-1);
|
||||||
|
|
||||||
/* Between voting starts and fetch missing */
|
/* Between voting starts and fetch missing */
|
||||||
vote = dirvote_add_vote(VOTE_BODY_V3,
|
vote = dirvote_add_vote(VOTE_BODY_V3,
|
||||||
@ -2781,7 +2781,7 @@ test_dir_handle_get_status_vote_too_late(void* data)
|
|||||||
/* Move the pending vote to previous vote */
|
/* Move the pending vote to previous vote */
|
||||||
dirvote_act(mock_options, now+1);
|
dirvote_act(mock_options, now+1);
|
||||||
/* And reset the timing */
|
/* And reset the timing */
|
||||||
voting_schedule_recalculate_timing(mock_options, now-1);
|
dirauth_sched_recalculate_timing(mock_options, now-1);
|
||||||
|
|
||||||
/* On voting starts */
|
/* On voting starts */
|
||||||
vote = dirvote_add_vote(VOTE_BODY_V3,
|
vote = dirvote_add_vote(VOTE_BODY_V3,
|
||||||
@ -2792,7 +2792,7 @@ test_dir_handle_get_status_vote_too_late(void* data)
|
|||||||
/* Move the pending vote to previous vote */
|
/* Move the pending vote to previous vote */
|
||||||
dirvote_act(mock_options, now+1);
|
dirvote_act(mock_options, now+1);
|
||||||
/* And reset the timing */
|
/* And reset the timing */
|
||||||
voting_schedule_recalculate_timing(mock_options, now-1);
|
dirauth_sched_recalculate_timing(mock_options, now-1);
|
||||||
|
|
||||||
/* Just before voting starts */
|
/* Just before voting starts */
|
||||||
vote = dirvote_add_vote(VOTE_BODY_V3,
|
vote = dirvote_add_vote(VOTE_BODY_V3,
|
||||||
|
@ -853,7 +853,7 @@ test_time_between_tp_and_srv(void *arg)
|
|||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 01:00:00 UTC", &ns.fresh_until);
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 01:00:00 UTC", &ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns.valid_after);
|
||||||
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
|
|
||||||
@ -861,7 +861,7 @@ test_time_between_tp_and_srv(void *arg)
|
|||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 12:00:00 UTC", &ns.fresh_until);
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 12:00:00 UTC", &ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns.valid_after);
|
||||||
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
|
|
||||||
@ -869,7 +869,7 @@ test_time_between_tp_and_srv(void *arg)
|
|||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 13:00:00 UTC", &ns.fresh_until);
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 13:00:00 UTC", &ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns.valid_after);
|
||||||
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
||||||
tt_int_op(ret, OP_EQ, 1);
|
tt_int_op(ret, OP_EQ, 1);
|
||||||
|
|
||||||
@ -877,7 +877,7 @@ test_time_between_tp_and_srv(void *arg)
|
|||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
ret = parse_rfc1123_time("Sat, 27 Oct 1985 00:00:00 UTC", &ns.fresh_until);
|
ret = parse_rfc1123_time("Sat, 27 Oct 1985 00:00:00 UTC", &ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns.valid_after);
|
||||||
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
||||||
tt_int_op(ret, OP_EQ, 1);
|
tt_int_op(ret, OP_EQ, 1);
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ test_time_between_tp_and_srv(void *arg)
|
|||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
ret = parse_rfc1123_time("Sat, 27 Oct 1985 01:00:00 UTC", &ns.fresh_until);
|
ret = parse_rfc1123_time("Sat, 27 Oct 1985 01:00:00 UTC", &ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns.valid_after);
|
||||||
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
ret = hs_in_period_between_tp_and_srv(&ns, 0);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
|
|
||||||
@ -1372,7 +1372,7 @@ run_reachability_scenario(const reachability_cfg_t *cfg, int num_scenario)
|
|||||||
&mock_service_ns->valid_until);
|
&mock_service_ns->valid_until);
|
||||||
set_consensus_times(cfg->service_valid_until,
|
set_consensus_times(cfg->service_valid_until,
|
||||||
&mock_service_ns->fresh_until);
|
&mock_service_ns->fresh_until);
|
||||||
voting_schedule_recalculate_timing(get_options(),
|
dirauth_sched_recalculate_timing(get_options(),
|
||||||
mock_service_ns->valid_after);
|
mock_service_ns->valid_after);
|
||||||
/* Check that service is in the right time period point */
|
/* Check that service is in the right time period point */
|
||||||
tt_int_op(hs_in_period_between_tp_and_srv(mock_service_ns, 0), OP_EQ,
|
tt_int_op(hs_in_period_between_tp_and_srv(mock_service_ns, 0), OP_EQ,
|
||||||
@ -1385,7 +1385,7 @@ run_reachability_scenario(const reachability_cfg_t *cfg, int num_scenario)
|
|||||||
&mock_client_ns->valid_until);
|
&mock_client_ns->valid_until);
|
||||||
set_consensus_times(cfg->client_valid_until,
|
set_consensus_times(cfg->client_valid_until,
|
||||||
&mock_client_ns->fresh_until);
|
&mock_client_ns->fresh_until);
|
||||||
voting_schedule_recalculate_timing(get_options(),
|
dirauth_sched_recalculate_timing(get_options(),
|
||||||
mock_client_ns->valid_after);
|
mock_client_ns->valid_after);
|
||||||
/* Check that client is in the right time period point */
|
/* Check that client is in the right time period point */
|
||||||
tt_int_op(hs_in_period_between_tp_and_srv(mock_client_ns, 0), OP_EQ,
|
tt_int_op(hs_in_period_between_tp_and_srv(mock_client_ns, 0), OP_EQ,
|
||||||
@ -1608,7 +1608,7 @@ helper_set_consensus_and_system_time(networkstatus_t *ns, int position)
|
|||||||
} else {
|
} else {
|
||||||
tt_assert(0);
|
tt_assert(0);
|
||||||
}
|
}
|
||||||
voting_schedule_recalculate_timing(get_options(), ns->valid_after);
|
dirauth_sched_recalculate_timing(get_options(), ns->valid_after);
|
||||||
|
|
||||||
/* Set system time: pretend to be just 2 minutes before consensus expiry */
|
/* Set system time: pretend to be just 2 minutes before consensus expiry */
|
||||||
real_time = ns->valid_until - 120;
|
real_time = ns->valid_until - 120;
|
||||||
|
@ -1365,7 +1365,7 @@ test_rotate_descriptors(void *arg)
|
|||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
|
||||||
&mock_ns.fresh_until);
|
&mock_ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), mock_ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), mock_ns.valid_after);
|
||||||
|
|
||||||
update_approx_time(mock_ns.valid_after+1);
|
update_approx_time(mock_ns.valid_after+1);
|
||||||
now = mock_ns.valid_after+1;
|
now = mock_ns.valid_after+1;
|
||||||
@ -1406,7 +1406,7 @@ test_rotate_descriptors(void *arg)
|
|||||||
ret = parse_rfc1123_time("Sat, 27 Oct 1985 02:00:00 UTC",
|
ret = parse_rfc1123_time("Sat, 27 Oct 1985 02:00:00 UTC",
|
||||||
&mock_ns.fresh_until);
|
&mock_ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), mock_ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), mock_ns.valid_after);
|
||||||
|
|
||||||
update_approx_time(mock_ns.valid_after+1);
|
update_approx_time(mock_ns.valid_after+1);
|
||||||
now = mock_ns.valid_after+1;
|
now = mock_ns.valid_after+1;
|
||||||
@ -1474,7 +1474,7 @@ test_build_update_descriptors(void *arg)
|
|||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 04:00:00 UTC",
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 04:00:00 UTC",
|
||||||
&mock_ns.fresh_until);
|
&mock_ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), mock_ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), mock_ns.valid_after);
|
||||||
|
|
||||||
update_approx_time(mock_ns.valid_after+1);
|
update_approx_time(mock_ns.valid_after+1);
|
||||||
|
|
||||||
@ -1705,7 +1705,7 @@ test_build_descriptors(void *arg)
|
|||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 04:00:00 UTC",
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 04:00:00 UTC",
|
||||||
&mock_ns.fresh_until);
|
&mock_ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), mock_ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), mock_ns.valid_after);
|
||||||
|
|
||||||
/* Generate a valid number of fake auth clients when a client authorization
|
/* Generate a valid number of fake auth clients when a client authorization
|
||||||
* is disabled. */
|
* is disabled. */
|
||||||
@ -1806,7 +1806,7 @@ test_upload_descriptors(void *arg)
|
|||||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
|
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
|
||||||
&mock_ns.fresh_until);
|
&mock_ns.fresh_until);
|
||||||
tt_int_op(ret, OP_EQ, 0);
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), mock_ns.valid_after);
|
dirauth_sched_recalculate_timing(get_options(), mock_ns.valid_after);
|
||||||
|
|
||||||
update_approx_time(mock_ns.valid_after+1);
|
update_approx_time(mock_ns.valid_after+1);
|
||||||
now = mock_ns.valid_after+1;
|
now = mock_ns.valid_after+1;
|
||||||
|
@ -193,7 +193,7 @@ test_get_state_valid_until_time(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:01 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:01 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
valid_until_time = get_state_valid_until_time(current_time);
|
valid_until_time = get_state_valid_until_time(current_time);
|
||||||
|
|
||||||
/* Compare it with the correct result */
|
/* Compare it with the correct result */
|
||||||
@ -205,7 +205,7 @@ test_get_state_valid_until_time(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 19:22:00 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 19:22:00 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
valid_until_time = get_state_valid_until_time(current_time);
|
valid_until_time = get_state_valid_until_time(current_time);
|
||||||
|
|
||||||
format_iso_time(tbuf, valid_until_time);
|
format_iso_time(tbuf, valid_until_time);
|
||||||
@ -216,7 +216,7 @@ test_get_state_valid_until_time(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 23:59:00 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 23:59:00 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
valid_until_time = get_state_valid_until_time(current_time);
|
valid_until_time = get_state_valid_until_time(current_time);
|
||||||
|
|
||||||
format_iso_time(tbuf, valid_until_time);
|
format_iso_time(tbuf, valid_until_time);
|
||||||
@ -227,7 +227,7 @@ test_get_state_valid_until_time(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:00 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:00 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
valid_until_time = get_state_valid_until_time(current_time);
|
valid_until_time = get_state_valid_until_time(current_time);
|
||||||
|
|
||||||
format_iso_time(tbuf, valid_until_time);
|
format_iso_time(tbuf, valid_until_time);
|
||||||
@ -265,7 +265,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:01 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:01 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
||||||
|
|
||||||
/* Compare it with the correct result */
|
/* Compare it with the correct result */
|
||||||
@ -277,7 +277,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 23:59:59 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 23:59:59 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
||||||
|
|
||||||
/* Compare it with the correct result */
|
/* Compare it with the correct result */
|
||||||
@ -289,7 +289,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:00 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:00:00 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
||||||
|
|
||||||
/* Compare it with the correct result */
|
/* Compare it with the correct result */
|
||||||
@ -319,7 +319,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
update_approx_time(current_time);
|
update_approx_time(current_time);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
|
|
||||||
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
format_iso_time(tbuf, run_start_time);
|
format_iso_time(tbuf, run_start_time);
|
||||||
tt_str_op("2015-04-19 00:00:00", OP_EQ, tbuf);
|
tt_str_op("2015-04-19 00:00:00", OP_EQ, tbuf);
|
||||||
/* Check that voting_schedule.interval_starts is at 01:00 (see above) */
|
/* Check that voting_schedule.interval_starts is at 01:00 (see above) */
|
||||||
time_t interval_starts = voting_schedule_get_next_valid_after_time();
|
time_t interval_starts = dirauth_sched_get_next_valid_after_time();
|
||||||
format_iso_time(tbuf, interval_starts);
|
format_iso_time(tbuf, interval_starts);
|
||||||
tt_str_op("2015-04-20 01:00:00", OP_EQ, tbuf);
|
tt_str_op("2015-04-20 01:00:00", OP_EQ, tbuf);
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ test_get_start_time_of_current_run(void *arg)
|
|||||||
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:15:32 UTC",
|
retval = parse_rfc1123_time("Mon, 20 Apr 2015 00:15:32 UTC",
|
||||||
¤t_time);
|
¤t_time);
|
||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
voting_schedule_recalculate_timing(get_options(), current_time);
|
dirauth_sched_recalculate_timing(get_options(), current_time);
|
||||||
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
run_start_time = sr_state_get_start_time_of_current_protocol_run();
|
||||||
|
|
||||||
/* Compare it with the correct result */
|
/* Compare it with the correct result */
|
||||||
@ -378,7 +378,7 @@ test_get_start_time_functions(void *arg)
|
|||||||
tt_int_op(retval, OP_EQ, 0);
|
tt_int_op(retval, OP_EQ, 0);
|
||||||
time_t now = mock_consensus.valid_after;
|
time_t now = mock_consensus.valid_after;
|
||||||
|
|
||||||
voting_schedule_recalculate_timing(get_options(), now);
|
dirauth_sched_recalculate_timing(get_options(), now);
|
||||||
time_t start_time_of_protocol_run =
|
time_t start_time_of_protocol_run =
|
||||||
sr_state_get_start_time_of_current_protocol_run();
|
sr_state_get_start_time_of_current_protocol_run();
|
||||||
tt_assert(start_time_of_protocol_run);
|
tt_assert(start_time_of_protocol_run);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
static void
|
static void
|
||||||
test_voting_schedule_interval_start(void *arg)
|
test_voting_schedule_interval_start(void *arg)
|
||||||
{
|
{
|
||||||
#define next_interval voting_schedule_get_start_of_next_interval
|
#define next_interval voting_sched_get_start_of_interval_after
|
||||||
(void)arg;
|
(void)arg;
|
||||||
char buf[ISO_TIME_LEN+1];
|
char buf[ISO_TIME_LEN+1];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user