Fix UB due to integer overflow
This commit is contained in:
parent
0364311dd0
commit
2de1d6c359
@ -581,7 +581,7 @@ class Raft {
|
|||||||
const Time now = io_.Now();
|
const Time now = io_.Now();
|
||||||
const Duration broadcast_timeout = RandomTimeout(kMinimumBroadcastTimeout, kMaximumBroadcastTimeout);
|
const Duration broadcast_timeout = RandomTimeout(kMinimumBroadcastTimeout, kMaximumBroadcastTimeout);
|
||||||
|
|
||||||
if (now - leader.last_broadcast > broadcast_timeout) {
|
if (now > leader.last_broadcast + broadcast_timeout) {
|
||||||
BroadcastAppendEntries(leader.followers);
|
BroadcastAppendEntries(leader.followers);
|
||||||
leader.last_broadcast = now;
|
leader.last_broadcast = now;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user