mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 22:51:35 +08:00
Raft - minor timing fix, no changes to the logic
This commit is contained in:
@@ -156,10 +156,7 @@ private:
|
|||||||
bool isActivityTimedOut() const
|
bool isActivityTimedOut() const
|
||||||
{
|
{
|
||||||
const int multiplier = static_cast<int>(getNode().getNodeID().get()) - 1;
|
const int multiplier = static_cast<int>(getNode().getNodeID().get()) - 1;
|
||||||
|
const MonotonicDuration activity_timeout = base_activity_timeout_ + update_interval_ * multiplier;
|
||||||
const MonotonicDuration activity_timeout =
|
|
||||||
MonotonicDuration::fromUSec(base_activity_timeout_.toUSec() + update_interval_.toUSec() * multiplier);
|
|
||||||
|
|
||||||
return getNode().getMonotonicTime() > (last_activity_timestamp_ + activity_timeout);
|
return getNode().getMonotonicTime() > (last_activity_timestamp_ + activity_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,7 +795,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Initializing state variables
|
* Initializing state variables
|
||||||
*/
|
*/
|
||||||
last_activity_timestamp_ = getNode().getMonotonicTime();
|
last_activity_timestamp_ = getNode().getMonotonicTime() + update_interval_;
|
||||||
active_mode_ = true;
|
active_mode_ = true;
|
||||||
server_state_ = ServerStateFollower;
|
server_state_ = ServerStateFollower;
|
||||||
next_server_index_ = 0;
|
next_server_index_ = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user