From c57f92c050ac7b002954d92a2016b793b5b32a7d Mon Sep 17 00:00:00 2001 From: Luca Terracciano Date: Tue, 23 Sep 2025 09:56:48 +0200 Subject: [PATCH] fix: tryListen returns the correct value --- include/hicr/frontends/RPCEngine/RPCEngine.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/hicr/frontends/RPCEngine/RPCEngine.hpp b/include/hicr/frontends/RPCEngine/RPCEngine.hpp index 3cbeb0ad..6f1924e6 100644 --- a/include/hicr/frontends/RPCEngine/RPCEngine.hpp +++ b/include/hicr/frontends/RPCEngine/RPCEngine.hpp @@ -190,11 +190,14 @@ class RPCEngine */ __INLINE__ bool tryListen() { + // If there are messages to process early return + if (_RPCConsumerChannel->getDepth() > 0) return true; + // If the channel is empty, check if new messages arrived since last check - if (_RPCConsumerChannel->getDepth() == 0) _RPCConsumerChannel->updateDepth(); + _RPCConsumerChannel->updateDepth(); // Return whether there are new messages - return _RPCConsumerChannel->getDepth() == 0; + return _RPCConsumerChannel->getDepth() > 0; } __INLINE__ void parseAndExecuteRPC()