From 5c447b7376f1affefbe27551d1eb3dea1d9220f2 Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Wed, 5 Mar 2025 17:03:46 +0100 Subject: [PATCH 1/2] fix to set valid reply when no calib task --- examples/15-ODC.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/15-ODC.cxx b/examples/15-ODC.cxx index f6c0cca0..3118f37b 100644 --- a/examples/15-ODC.cxx +++ b/examples/15-ODC.cxx @@ -99,6 +99,7 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) { std::string calibTasksJson; const std::lock_guard lock(gMapAccess); calibTasksJson += "[" + std::to_string(0); + int countOk = 0; for (const auto& run : gStats) { if (run.second.TasksPerCalib.find(calib) != run.second.TasksPerCalib.end()) { calibTasksJson += ", \""; @@ -113,9 +114,14 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) { } else { calibTasksJson += ",0"; } + countOk++; } } calibTasksJson += "]"; + // workaround to set valid reply if nothing to report + if (!countOk) { + calibTasksJson = "[0, \"\", 0, 0]"; + } beast::ostream(response.body()) << jsonPrefix << calibTasksJson << jsonSuffix << '\n'; }); connection->start(); From 9882100ecb0705de24ca28605c81a0fc2eb52d61 Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Wed, 5 Mar 2025 17:08:02 +0100 Subject: [PATCH 2/2] v3.19.3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e4a95e5..552f3d76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ endif() # Define project project(Monitoring - VERSION 3.19.2 + VERSION 3.19.3 DESCRIPTION "O2 Monitoring library" LANGUAGES CXX )