From c323d8e724a24a66a591ca550adb7421c3e42b42 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 24 May 2015 20:12:33 +0300 Subject: [PATCH] Raft - ignoring Allocation activity if it is a response --- .../dynamic_node_id_server/distributed/raft_core.hpp | 2 +- .../protocol/dynamic_node_id_server/distributed/server.hpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/raft_core.hpp b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/raft_core.hpp index 3066d8da88..4f3b0a9d05 100644 --- a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/raft_core.hpp +++ b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/raft_core.hpp @@ -61,7 +61,7 @@ public: * Active state switch logic: * Activation (this is default state): * - vote request - * - allocation activity detected + * - allocation request at any stage * - only if leader: * - discovery activity detected * - log is not fully replicated or there are uncommitted entries diff --git a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/server.hpp b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/server.hpp index 22b3a4b9be..03c4ede47c 100644 --- a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/server.hpp +++ b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/distributed/server.hpp @@ -135,9 +135,12 @@ class UAVCAN_EXPORT Server : IAllocationRequestHandler } } - virtual void handleAllocationActivityDetection(const ReceivedDataStructure&) + virtual void handleAllocationActivityDetection(const ReceivedDataStructure& msg) { - raft_core_.forceActiveMode(); + if (msg.isAnonymousTransfer()) + { + raft_core_.forceActiveMode(); + } } /*