- // 处理 certificate 的时候明确 new-round,pacemaker 更新本地 round
- pub fn process_certificates(
- &mut self,
- hqc_round: Option<Round>,
- htc_round: Option<Round>,
- highest_committed_round: Option<Round>,
- ) -> Option<NewRoundEvent> {
- // 明确计算出新的轮次后才会更新轮次
- let new_round = std::cmp::max(qc_round, tc_round) + 1;
- if new_round> self.current_round {
- // Start a new round.
- self.current_round = new_round;
- // 新轮次重置超时
- let timeout = self.setup_timeout();
- let new_round_reason = if qc_round>= tc_round {
- NewRoundReason::QCReady
- } else {
- NewRoundReason::Timeout
- };
- let new_round_event = NewRoundEvent {
- round: self.current_round,
- reason: new_round_reason,
- timeout,
- };
- debug!("Starting new round: {}", new_round_event);
- return Some(new_round_event);
- }
来源: https://www.cnblogs.com/SkyMouse/p/12488899.html