Closed johningve closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 73.03%. Comparing base (
6c1fcb7
) to head (27c2653
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The timer used by the synchronizer used to be resettable, but after https://github.com/relab/hotstuff/commit/7776a29f8668f3f20b221b57164ab6597c3c2fc6, the closure passed to the timer should only be used once because it stores the current view. This was done so that we can avoid the need for any synchronization of access to the current view in the synchronizer. However, I failed to realize that this would make the timer only usable once. Thus, resetting it is not possible as the view that is stored in the timer's closure would not change upon reset.
This PR wraps the timer in a
oneShotTimer
struct that is intended to prevent the timer from being reused. Instead, the methodsstartTimeoutTimer
andstopTimeoutTimer
should be used instead of using the timer directly. These functions ensure that each timer is unique and thus a unique closure is used each time, ensuring that we get the correct view and avoid the need for synchronization code.