diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-07-18 16:06:12 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-08 20:29:34 -0400 |
commit | 2e5a2d64bd4d26323a226d1069b960b28bd25440 (patch) | |
tree | 4482242eed9d5448e32ea69091fcc82083156edb /src/test/test_hs_service.c | |
parent | 6c00bd1f10f4683824deeaa7dd8a23aaf6b9a40e (diff) | |
download | tor-2e5a2d64bd4d26323a226d1069b960b28bd25440.tar.gz tor-2e5a2d64bd4d26323a226d1069b960b28bd25440.zip |
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>
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r-- | src/test/test_hs_service.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index 1b8d8252eb..30f1682d8c 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -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); |