Skip to content

Commit f516fed

Browse files
committed
fix: tryListen returns the correct value
1 parent 60280f0 commit f516fed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/hicr/frontends/RPCEngine/RPCEngine.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,14 @@ class RPCEngine
190190
*/
191191
__INLINE__ bool tryListen()
192192
{
193+
// If there are messages to process early return
194+
if (_RPCConsumerChannel->getDepth() > 0) return true;
195+
193196
// If the channel is empty, check if new messages arrived since last check
194-
if (_RPCConsumerChannel->getDepth() == 0) _RPCConsumerChannel->updateDepth();
197+
_RPCConsumerChannel->updateDepth();
195198

196199
// Return whether there are new messages
197-
return _RPCConsumerChannel->getDepth() == 0;
200+
return _RPCConsumerChannel->getDepth() > 0;
198201
}
199202

200203
__INLINE__ void parseAndExecuteRPC()

0 commit comments

Comments
 (0)