Skip to content

Commit 57ef540

Browse files
authored
Merge pull request #352 from sy-c/dev
v3.19.3
2 parents 7fb48e4 + 9882100 commit 57ef540

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ endif()
3131

3232
# Define project
3333
project(Monitoring
34-
VERSION 3.19.2
34+
VERSION 3.19.3
3535
DESCRIPTION "O2 Monitoring library"
3636
LANGUAGES CXX
3737
)

examples/15-ODC.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
9999
std::string calibTasksJson;
100100
const std::lock_guard<std::mutex> lock(gMapAccess);
101101
calibTasksJson += "[" + std::to_string(0);
102+
int countOk = 0;
102103
for (const auto& run : gStats) {
103104
if (run.second.TasksPerCalib.find(calib) != run.second.TasksPerCalib.end()) {
104105
calibTasksJson += ", \"";
@@ -113,9 +114,14 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
113114
} else {
114115
calibTasksJson += ",0";
115116
}
117+
countOk++;
116118
}
117119
}
118120
calibTasksJson += "]";
121+
// workaround to set valid reply if nothing to report
122+
if (!countOk) {
123+
calibTasksJson = "[0, \"\", 0, 0]";
124+
}
119125
beast::ostream(response.body()) << jsonPrefix << calibTasksJson << jsonSuffix << '\n';
120126
});
121127
connection->start();

0 commit comments

Comments
 (0)