Skip to content

Commit f43af10

Browse files
committed
fix(rpc): Spies notified after data validation
This is a port from PR c-jimenez#260 by @jlaliMohamed on original repo. Signed-off-by: Thomas BRUNEL <thomas.brunel@madic.com>
1 parent ee550d3 commit f43af10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rpc/RpcBase.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,6 @@ void RpcBase::processReceivedData(const void* data, size_t size)
297297
{
298298
// Decode received data
299299
std::string received_data(reinterpret_cast<const char*>(data), size);
300-
for (ISpy* spy : m_spies)
301-
{
302-
spy->rcpMessageReceived(received_data);
303-
}
304300

305301
// RPC frame must be a JSON array
306302
bool valid = false;
@@ -315,6 +311,10 @@ void RpcBase::processReceivedData(const void* data, size_t size)
315311
}
316312
if (valid && rpc_frame.IsArray() && (rpc_frame.Size() >= 3))
317313
{
314+
for (ISpy* spy : m_spies)
315+
{
316+
spy->rcpMessageReceived(received_data);
317+
}
318318
// Extract message type
319319
const rapidjson::Value& msg_type_value = rpc_frame[0];
320320
if (msg_type_value.IsUint())

0 commit comments

Comments
 (0)