From 1ddec15b874ca123ee384f5689d6f9ff9c2e3b39 Mon Sep 17 00:00:00 2001 From: "andrey.bychkov" Date: Wed, 5 Aug 2026 19:47:35 +0300 Subject: [PATCH] threadsafe fixes --- libs/main/io_devices/pipeer.cpp | 5 ++++- libs/mqtt_client/pimqttclient.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/main/io_devices/pipeer.cpp b/libs/main/io_devices/pipeer.cpp index c121dfea..0cf8bd6a 100644 --- a/libs/main/io_devices/pipeer.cpp +++ b/libs/main/io_devices/pipeer.cpp @@ -623,7 +623,10 @@ bool PIPeer::dataRead(const uchar * readed, ssize_t size) { return true; } cnt++; - if (cnt > _PIPEER_MSG_TTL || from == dp->name) return true; + if (cnt > _PIPEER_MSG_TTL || from == dp->name) { + eth_mutex.unlock(); + return true; + } sba << type << from << to << cnt << pba; // piCout << "translate packet" << from << "->" << to << ", ttl =" << cnt; sendToNeighbour(dp, sba); diff --git a/libs/mqtt_client/pimqttclient.cpp b/libs/mqtt_client/pimqttclient.cpp index 60ffb958..133639e5 100644 --- a/libs/mqtt_client/pimqttclient.cpp +++ b/libs/mqtt_client/pimqttclient.cpp @@ -60,7 +60,7 @@ STATIC_INITIALIZER_END PRIVATE_DEFINITION_START(PIMQTT::Client) MQTTClient client = nullptr; - bool connected = false; + std::atomic connected{false}; PIProtectedVariable endpoints;