mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
prop224: Refactor the overlap function to not use absolute time.
We consider to be in overlap mode when we are in the period of time between a fresh SRV and the beginning of the new time period (in the normal network this is between 00:00 and 12:00 UTC). This commit edits that function to use the above semantic logic instead of absolute times. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
committed by
Nick Mathewson
parent
6c00bd1f10
commit
2e5a2d64bd
@@ -936,6 +936,8 @@ test_rotate_descriptors(void *arg)
|
||||
* overlap check doesn't care about the year. */
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 13:00:00 UTC",
|
||||
&mock_ns.valid_after);
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
|
||||
&mock_ns.fresh_until);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
|
||||
/* Create a service with a default descriptor and state. It's added to the
|
||||
@@ -954,6 +956,8 @@ test_rotate_descriptors(void *arg)
|
||||
/* Entering an overlap period. */
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 01:00:00 UTC",
|
||||
&mock_ns.valid_after);
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 02:00:00 UTC",
|
||||
&mock_ns.fresh_until);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
desc_next = service_descriptor_new();
|
||||
desc_next->next_upload_time = 42; /* Our marker to recognize it. */
|
||||
@@ -977,6 +981,8 @@ test_rotate_descriptors(void *arg)
|
||||
/* Going out of the overlap period. */
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 12:00:00 UTC",
|
||||
&mock_ns.valid_after);
|
||||
ret = parse_rfc1123_time("Sat, 26 Oct 1985 13:00:00 UTC",
|
||||
&mock_ns.fresh_until);
|
||||
/* This should reset the state and not touch the current descriptor. */
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
rotate_all_descriptors(now);
|
||||
|
||||
Reference in New Issue
Block a user