teor: while you're messing with that function, what would you think of adding an "if elapsed time is zero, just return" line in there? That way we only do the log_debug when we actually refilled something.
I think we should return if we don't do anything.
And we should return if the old time is zero, and the current time is zero.
Then I can turn those unit tests back on.
I've taken teor patch and fixed very minor thing (mostly syntax) and made the circuit_rate to be a uint64_t instead of casting it. The getter returns the uin32_t value so we are good in conversion there. Just one less cast.
I've re-arranged the commit to have 3 of them, (1) teor's test fix, (2) refill over/underflow checks, (3) add unit tests.
gcc and clang seems happy here.
Commits are in branch: ticket24902_029_05 so it is easy for nick to merge it forward into master. Let me know if you want me to move them to the _033_02 branch or just plain latest master.
Trac: Keywords: N/Adeleted, tor-dos added Status: needs_review to merge_ready
I've taken teor patch and fixed very minor thing (mostly syntax) and made the circuit_rate to be a uint64_t instead of casting it. The getter returns the uin32_t value so we are good in conversion there. Just one less cast.
This works, but there are no unit tests that make sure it does.
(We could add them if we liked.)
Also, there is no comment that explains why we return a uint32_t as a uint64_t.
I don't think we need to fix either of these things.
If anyone wants to, we can do it in master going forward.