From 99b7aa8579d8a0a962c46c7653197d3a481aabcb Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 23 Jul 2014 03:17:11 +0400 Subject: [PATCH] Properly handling the initial node status broadcast in passive mode --- libuavcan/src/protocol/uc_node_status_provider.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libuavcan/src/protocol/uc_node_status_provider.cpp b/libuavcan/src/protocol/uc_node_status_provider.cpp index 5a35c03c9b..c886bdc669 100644 --- a/libuavcan/src/protocol/uc_node_status_provider.cpp +++ b/libuavcan/src/protocol/uc_node_status_provider.cpp @@ -69,10 +69,15 @@ int NodeStatusProvider::startAndPublish() return -ErrNotInited; } - int res = publish(); // Initial broadcast - if (res < 0) + int res = -1; + + if (!getNode().isPassiveMode()) { - goto fail; + res = publish(); + if (res < 0) // Initial broadcast + { + goto fail; + } } res = gdr_sub_.start(GlobalDiscoveryRequestCallback(this, &NodeStatusProvider::handleGlobalDiscoveryRequest));