diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-13 12:03:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-13 16:31:47 -0400 |
commit | 003e6595bf355fd13f85eb31e7850cec086ecd07 (patch) | |
tree | 863d49e61461037271d128f285e19b4a0fa096c4 /src/test/test_bwmgt.c | |
parent | 2307bef7a2403a48d57e3e352d8befcd8c9f482e (diff) | |
download | tor-003e6595bf355fd13f85eb31e7850cec086ecd07.tar.gz tor-003e6595bf355fd13f85eb31e7850cec086ecd07.zip |
Refactor "timestamp" not to be its own type coupled to token buffers
Really, the uint32_t is only an optimization; any kind of unit
should work fine. Some users might want to use time_t or
monotime_coarse_t or something like that.
Diffstat (limited to 'src/test/test_bwmgt.c')
-rw-r--r-- | src/test/test_bwmgt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_bwmgt.c b/src/test/test_bwmgt.c index 17914aeb97..003671a42a 100644 --- a/src/test/test_bwmgt.c +++ b/src/test/test_bwmgt.c @@ -36,7 +36,7 @@ test_bwmgt_token_buf_init(void *arg) tt_uint_op(rate_per_sec, OP_LT, 16*KB+160); } // Bucket starts out full: - tt_uint_op(b.stamp.last_refilled_at, OP_EQ, START_TS); + tt_uint_op(b.last_refilled_at_timestamp, OP_EQ, START_TS); tt_int_op(b.read_bucket.bucket, OP_EQ, 64*KB); done: @@ -138,7 +138,7 @@ test_bwmgt_token_buf_refill(void *arg) tt_int_op(0, OP_EQ, token_bucket_rw_refill(&b, START_TS + SEC*3/2)); tt_int_op(b.read_bucket.bucket, OP_GT, 40*KB - 400); tt_int_op(b.read_bucket.bucket, OP_LT, 40*KB + 400); - tt_uint_op(b.stamp.last_refilled_at, OP_EQ, START_TS + SEC*3/2); + tt_uint_op(b.last_refilled_at_timestamp, OP_EQ, START_TS + SEC*3/2); /* No time: nothing happens. */ { @@ -150,12 +150,12 @@ test_bwmgt_token_buf_refill(void *arg) /* Another 30 seconds: fill the bucket. */ tt_int_op(0, OP_EQ, token_bucket_rw_refill(&b, START_TS + SEC*3/2 + SEC*30)); tt_int_op(b.read_bucket.bucket, OP_EQ, b.cfg.burst); - tt_uint_op(b.stamp.last_refilled_at, OP_EQ, START_TS + SEC*3/2 + SEC*30); + tt_uint_op(b.last_refilled_at_timestamp, OP_EQ, START_TS + SEC*3/2 + SEC*30); /* Another 30 seconds: nothing happens. */ tt_int_op(0, OP_EQ, token_bucket_rw_refill(&b, START_TS + SEC*3/2 + SEC*60)); tt_int_op(b.read_bucket.bucket, OP_EQ, b.cfg.burst); - tt_uint_op(b.stamp.last_refilled_at, OP_EQ, START_TS + SEC*3/2 + SEC*60); + tt_uint_op(b.last_refilled_at_timestamp, OP_EQ, START_TS + SEC*3/2 + SEC*60); /* Empty the bucket, let two seconds pass, and make sure that a refill is * noticed. */ |