GCC Code Coverage Report


Directory: ./
File: Warnings.cpp
Date: 2026-12-01 12:27:28
Exec Total Coverage
Lines: 159 171 93.0%
Functions: 21 23 91.3%
Branches: 170 294 57.8%

Line Branch Exec Source
1 /*
2 * This file is part of the Falcon Player (FPP) and is Copyright (C)
3 * 2013-2022 by the Falcon Player Developers.
4 *
5 * The Falcon Player (FPP) is free software, and is covered under
6 * multiple Open Source licenses. Please see the included 'LICENSES'
7 * file for descriptions of what files are covered by each license.
8 *
9 * This source file is covered under the LGPL v2.1 as described in the
10 * included LICENSE.LGPL file.
11 */
12
13 #include "fpp-pch.h"
14
15 #include <algorithm>
16 #include <atomic>
17 #include <mutex>
18 #include <semaphore>
19 #include <set>
20 #include <shared_mutex>
21 #include <stdio.h>
22 #include <thread>
23 #include <utility>
24
25 #include "fpp-json.h" // Json::Value -- the serialization side of FPPWarning lives here
26
27 #include "Warnings.h"
28 #include "common.h"
29 #include "log.h"
30 #include "settings.h"
31
32 using namespace std::chrono;
33
34 namespace
35 {
36 std::list<FPPWarning> warnings;
37 std::shared_mutex warningsLock;
38 std::mutex listenerListLock;
39 std::set<WarningListener*> listenerList;
40 steady_clock::time_point wakeUpTime = steady_clock::time_point::max();
41 std::atomic_bool runNotifyThread{ false };
42 // Intentionally leaked: if this were a plain static, __cxa_finalize would
43 // run ~thread() on ANY exit() call (early startup failures call exit(1)
44 // long before the orderly _exit(0) at the end of main()), and destroying
45 // a still-joinable std::thread calls std::terminate. Leaking the object
46 // means the destructor never runs; StopNotifyThread still joins it on the
47 // orderly shutdown path.
48 std::thread& notifyThread = *new std::thread();
49 std::binary_semaphore sema{ 0 };
50 }
51
52 static void PruneWarnings();
53
54 2084 FPPWarning::FPPWarning(int i, const std::string& m, const std::string& p) :
55 2084 m_id(i),
56
1/2
✓ Branch 0 taken 2084 times.
✗ Branch 1 not taken.
2084 m_message(m),
57
1/2
✓ Branch 0 taken 2084 times.
✗ Branch 1 not taken.
4168 m_plugin(p) {
58 2084 timeout = steady_clock::time_point::max();
59 2084 }
60
61 24916 Json::Value FPPWarning::toJsonValue() const {
62 24916 Json::Value v;
63
2/4
✓ Branch 0 taken 24916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24916 times.
✗ Branch 3 not taken.
24916 v["id"] = m_id;
64
2/4
✓ Branch 0 taken 24916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24916 times.
✗ Branch 3 not taken.
24916 v["message"] = m_message;
65
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 24912 times.
24916 if (!m_plugin.empty()) {
66
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 v["plugin"] = m_plugin;
67 }
68
2/2
✓ Branch 0 taken 82 times.
✓ Branch 1 taken 24916 times.
24998 for (auto& kv : data) {
69
3/6
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 82 times.
✗ Branch 5 not taken.
82 v["data"][kv.first] = kv.second;
70 }
71 24916 return v;
72 ✗ }
73
74 5298 void WarningHolder::AddWarningListener(WarningListener* l) {
75
1/2
✓ Branch 0 taken 5298 times.
✗ Branch 1 not taken.
5298 LogDebug(VB_GENERAL, "About to add listener\n");
76
1/2
✓ Branch 0 taken 5298 times.
✗ Branch 1 not taken.
5298 std::unique_lock<std::mutex> lock(listenerListLock);
77
1/2
✓ Branch 0 taken 5298 times.
✗ Branch 1 not taken.
5298 listenerList.insert(l);
78
1/2
✓ Branch 0 taken 5298 times.
✗ Branch 1 not taken.
5298 LogDebug(VB_GENERAL, "Adding Listener Done\n");
79 5298 }
80
81 5240 void WarningHolder::RemoveWarningListener(WarningListener* l) {
82
1/2
✓ Branch 0 taken 5240 times.
✗ Branch 1 not taken.
5240 std::unique_lock<std::mutex> lock(listenerListLock);
83
2/4
✓ Branch 0 taken 5240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5240 times.
✗ Branch 3 not taken.
5240 if (listenerList.erase(l)) {
84
1/2
✓ Branch 0 taken 5240 times.
✗ Branch 1 not taken.
5240 LogDebug(VB_GENERAL, "Removing Warning Listener Complete\n");
85 } else {
86 ✗ LogWarn(VB_GENERAL, "Requested to remove Listener, but it wasn't found\n");
87 }
88 5240 }
89
90 2652 void WarningHolder::StartNotifyThread() {
91 2652 runNotifyThread = true;
92
1/2
✓ Branch 0 taken 2652 times.
✗ Branch 1 not taken.
2652 notifyThread = std::thread(WarningHolder::WarningsThreadMain);
93 2652 }
94
95 2648 void WarningHolder::StopNotifyThread() {
96 2648 runNotifyThread = false;
97 2648 sema.release();
98 // Guard the join: StopNotifyThread() can run when the thread was never
99 // started (a crash signal arrives before StartNotifyThread) or has already
100 // been joined (normal shutdown joins it, then a later crash re-enters the
101 // signal handler). join() on a non-joinable thread throws std::system_error
102 // on both Linux and macOS -> terminate. joinable() makes it safe/idempotent.
103 // Nor from the notify thread itself (a crash inside a warnings listener
104 // reaches here on that thread): joining yourself throws, which would
105 // terminate from inside the crash handler.
106
5/6
✓ Branch 0 taken 2648 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2647 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 2647 times.
✓ Branch 5 taken 1 times.
2648 if (notifyThread.joinable() && notifyThread.get_id() != std::this_thread::get_id()) {
107 2647 notifyThread.join();
108 }
109 2648 }
110 5815 void WarningHolder::WriteWarningsFile() {
111
1/2
✓ Branch 0 taken 5815 times.
✗ Branch 1 not taken.
5815 Json::Value result = Json::Value(Json::ValueType::arrayValue);
112
1/2
✓ Branch 0 taken 5815 times.
✗ Branch 1 not taken.
5815 Json::Value resultFull = Json::Value(Json::ValueType::arrayValue);
113 {
114 // Only the copy is made under the lock. The writes below are file
115 // I/O on the SD card, and every AddWarning/RemoveWarning -- some on
116 // the output and media timing paths -- waits for this lock.
117
1/2
✓ Branch 0 taken 5815 times.
✗ Branch 1 not taken.
5815 std::shared_lock<std::shared_mutex> lock(warningsLock);
118
2/2
✓ Branch 0 taken 5382 times.
✓ Branch 1 taken 5815 times.
11197 for (auto& warn : warnings) {
119
2/4
✓ Branch 0 taken 5382 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5382 times.
✗ Branch 3 not taken.
5382 result.append(warn.message());
120
2/4
✓ Branch 0 taken 5382 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5382 times.
✗ Branch 3 not taken.
5382 resultFull.append(warn.toJsonValue());
121 }
122 5815 }
123
4/8
✓ Branch 0 taken 5815 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5815 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5815 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5815 times.
✗ Branch 7 not taken.
23260 SaveJsonToFile(result, getFPPDDir("/www/warnings.json"));
124
4/8
✓ Branch 0 taken 5815 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5815 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5815 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5815 times.
✗ Branch 7 not taken.
17445 SaveJsonToFile(resultFull, getFPPDDir("/www/warnings_full.json"));
125 5815 }
126 28 void WarningHolder::WriteCrashedWarningsFile(int id, const std::string& message) {
127
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 FPPWarning warn(id, message, "");
128
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 Json::Value result = Json::Value(Json::ValueType::arrayValue);
129
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 Json::Value resultFull = Json::Value(Json::ValueType::arrayValue);
130
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 result.append(warn.message());
131
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 resultFull.append(warn.toJsonValue());
132
4/8
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
112 SaveJsonToFile(result, getFPPDDir("/www/warnings.json"));
133
4/8
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
84 SaveJsonToFile(resultFull, getFPPDDir("/www/warnings_full.json"));
134 28 }
135 2620 void WarningHolder::ClearWarningsFile() {
136
2/4
✓ Branch 0 taken 2620 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2620 times.
✗ Branch 3 not taken.
5240 remove(getFPPDDir("/www/warnings.json").c_str());
137
2/4
✓ Branch 0 taken 2620 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2620 times.
✗ Branch 3 not taken.
2620 remove(getFPPDDir("/www/warnings_full.json").c_str());
138 2620 }
139
140 2652 void WarningHolder::WarningsThreadMain() {
141
2/4
✓ Branch 0 taken 2652 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2652 times.
✗ Branch 3 not taken.
2652 SetThreadName("FPP-Warnings");
142 2652 PruneWarnings();
143 2652 WriteWarningsFile();
144
2/2
✓ Branch 0 taken 5806 times.
✓ Branch 1 taken 3 times.
5809 while (runNotifyThread) {
145 // Read under warningsLock, which every writer of wakeUpTime holds.
146 5806 steady_clock::time_point wake;
147 {
148
1/2
✓ Branch 0 taken 5806 times.
✗ Branch 1 not taken.
5806 std::shared_lock<std::shared_mutex> lock(warningsLock);
149 5806 wake = wakeUpTime;
150 5806 }
151 5806 sema.try_acquire_until(wake);
152
2/2
✓ Branch 0 taken 2644 times.
✓ Branch 1 taken 3157 times.
5801 if (!runNotifyThread) {
153 2644 break;
154 }
155
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
3157 PruneWarnings();
156
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
3157 WriteWarningsFile();
157
158
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
3157 auto copy = GetWarnings();
159
160
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
3157 LogDebug(VB_GENERAL, "Warnings may have changed; notifying other threads of %zu Warnings\n", copy.size());
161
162
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
3157 std::unique_lock lock(listenerListLock);
163
1/2
✓ Branch 0 taken 3157 times.
✗ Branch 1 not taken.
8590 std::for_each(listenerList.begin(), listenerList.end(), [&](WarningListener* l) { l->handleWarnings(copy); });
164 3157 }
165 2647 }
166
167 33 void WarningHolder::AddWarning(const std::string& w) {
168
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
37 AddWarningTimeout(-1, UNKNOWN_WARNING_ID, w);
169 33 }
170 11 void WarningHolder::AddWarningTimeout(const std::string& w, int seconds) {
171
2/4
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
11 AddWarningTimeout(seconds, UNKNOWN_WARNING_ID, w);
172 11 }
173 ✗ void WarningHolder::RemoveWarning(const std::string& w) {
174 ✗ RemoveWarning(UNKNOWN_WARNING_ID, w);
175 ✗ }
176 1599 void WarningHolder::AddWarning(int id, const std::string& w, const std::map<std::string, std::string>& data) {
177
2/4
✓ Branch 0 taken 1599 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1599 times.
✗ Branch 3 not taken.
1599 AddWarningTimeout(-1, id, w, data);
178 1599 }
179 4 void WarningHolder::AddWarning(int id, const std::string& w, const std::string& fixUrl, const std::string& fixText) {
180 4 std::map<std::string, std::string> data;
181
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (!fixUrl.empty()) {
182
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 data["fixUrl"] = fixUrl;
183 }
184
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (!fixText.empty()) {
185
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 data["fixText"] = fixText;
186 }
187
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 AddWarningTimeout(-1, id, w, data);
188 4 }
189
190 3205 void WarningHolder::AddWarningTimeout(int sec, int id, const std::string& w, const std::map<std::string, std::string>& data, const std::string& plugin) {
191
1/2
✓ Branch 0 taken 3205 times.
✗ Branch 1 not taken.
3205 LogDebug(VB_GENERAL, "Adding Warning: %s\n", w.c_str());
192 3205 steady_clock::time_point timeoutTime = steady_clock::time_point::max();
193
2/2
✓ Branch 0 taken 1564 times.
✓ Branch 1 taken 1641 times.
3205 if (sec != -1) {
194
1/2
✓ Branch 0 taken 1564 times.
✗ Branch 1 not taken.
1564 timeoutTime = steady_clock::now() + seconds(sec);
195 }
196
1/2
✓ Branch 0 taken 3205 times.
✗ Branch 1 not taken.
3205 std::unique_lock<std::shared_mutex> lock(warningsLock);
197
2/2
✓ Branch 0 taken 3754 times.
✓ Branch 1 taken 2056 times.
5810 for (auto it = warnings.begin(); it != warnings.end(); ++it) {
198
6/6
✓ Branch 0 taken 3413 times.
✓ Branch 1 taken 341 times.
✓ Branch 2 taken 1149 times.
✓ Branch 3 taken 2264 times.
✓ Branch 4 taken 1149 times.
✓ Branch 5 taken 2605 times.
3754 if (it->id() == id && it->message() == w) {
199 // Timeout is allowed to move later, but not earlier
200
3/4
✓ Branch 0 taken 1149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 574 times.
✓ Branch 3 taken 575 times.
1149 if (timeoutTime > it->timeout)
201 574 it->timeout = timeoutTime;
202 1149 return;
203 }
204 }
205
206
1/2
✓ Branch 0 taken 2056 times.
✗ Branch 1 not taken.
2056 auto& ref = warnings.emplace_back(id, w, plugin);
207
1/2
✓ Branch 0 taken 2056 times.
✗ Branch 1 not taken.
2056 ref.data = data;
208
209 2056 ref.timeout = timeoutTime;
210
3/4
✓ Branch 0 taken 2056 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 1912 times.
2056 if (timeoutTime < wakeUpTime) {
211 144 wakeUpTime = timeoutTime;
212 }
213
1/2
✓ Branch 0 taken 2056 times.
✗ Branch 1 not taken.
2056 lock.unlock();
214
215 // Notify Listeners
216 2056 sema.release();
217
2/2
✓ Branch 0 taken 2056 times.
✓ Branch 1 taken 1149 times.
3205 }
218 20439 void WarningHolder::RemoveWarning(int id, const std::string& w, const std::string& plugin) {
219
1/2
✓ Branch 0 taken 20439 times.
✗ Branch 1 not taken.
20439 LogDebug(VB_GENERAL, "Removing Warning: %s\n", w.c_str());
220
1/2
✓ Branch 0 taken 20439 times.
✗ Branch 1 not taken.
20439 std::unique_lock<std::shared_mutex> lock(warningsLock);
221
2/2
✓ Branch 0 taken 5479 times.
✓ Branch 1 taken 19248 times.
24727 for (auto it = warnings.begin(); it != warnings.end(); ++it) {
222
7/8
✓ Branch 0 taken 1497 times.
✓ Branch 1 taken 3982 times.
✓ Branch 2 taken 1191 times.
✓ Branch 3 taken 306 times.
✓ Branch 4 taken 1191 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1191 times.
✓ Branch 7 taken 4288 times.
5479 if (it->id() == id && it->message() == w && it->plugin() == plugin) {
223 1191 warnings.erase(it);
224
1/2
✓ Branch 0 taken 1191 times.
✗ Branch 1 not taken.
1191 lock.unlock();
225 // Notify Listeners
226 1191 sema.release();
227 1191 return;
228 }
229 }
230
2/2
✓ Branch 0 taken 19248 times.
✓ Branch 1 taken 1191 times.
20439 }
231 3000 void WarningHolder::UpdateLogLevelWarnings() {
232 // Called from the API, the command socket and settings reloads; crossed
233 // Remove/Add pairs could leave a stale level's warning up.
234 static std::mutex updateLock;
235
1/2
✓ Branch 0 taken 3000 times.
✗ Branch 1 not taken.
3000 std::lock_guard<std::mutex> lock(updateLock);
236 // Only touch the warning that changed: an unchanged one is not removed
237 // and re-added, so a reload doesn't blink it or wake the listeners.
238
1/2
✓ Branch 0 taken 3000 times.
✗ Branch 1 not taken.
3000 int lowestLogLevel = FPPLogger::INSTANCE.MinimumLogLevel();
239
2/2
✓ Branch 0 taken 2897 times.
✓ Branch 1 taken 103 times.
3000 if (lowestLogLevel != LOG_EXCESSIVE)
240
3/6
✓ Branch 0 taken 2897 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2897 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2897 times.
✗ Branch 5 not taken.
11588 RemoveWarning(2, EXCESSIVE_LOG_LEVEL_WARNING);
241
2/2
✓ Branch 0 taken 2698 times.
✓ Branch 1 taken 302 times.
3000 if (lowestLogLevel != LOG_DEBUG)
242
3/6
✓ Branch 0 taken 2698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2698 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2698 times.
✗ Branch 5 not taken.
10792 RemoveWarning(3, DEBUG_LOG_LEVEL_WARNING);
243
2/2
✓ Branch 0 taken 103 times.
✓ Branch 1 taken 2897 times.
3000 if (lowestLogLevel == LOG_EXCESSIVE)
244
2/4
✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
309 AddWarning(2, EXCESSIVE_LOG_LEVEL_WARNING);
245
2/2
✓ Branch 0 taken 302 times.
✓ Branch 1 taken 2595 times.
2897 else if (lowestLogLevel == LOG_DEBUG)
246
2/4
✓ Branch 0 taken 302 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 302 times.
✗ Branch 3 not taken.
859 AddWarning(3, DEBUG_LOG_LEVEL_WARNING);
247 3000 }
248
249 // Comes down by its timeout: a loader that still finds the entry raises it again.
250 static constexpr int INVALID_CONFIG_ENTRY_WARNING_ID = 73;
251
252 49 void WarningHolder::InvalidConfigEntry(const std::string& file, const std::string& detail) {
253 49 LogErr(VB_GENERAL, "%s: skipping an entry that could not be read (%s)\n", file.c_str(), detail.c_str());
254
4/8
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 49 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 49 times.
✗ Branch 7 not taken.
49 AddWarningTimeout(3600, INVALID_CONFIG_ENTRY_WARNING_ID, file + " has an entry that could not be read and was skipped: " + detail);
255 49 }
256
257 ✗ void WarningHolder::RemoveAllWarnings() {
258 ✗ std::unique_lock<std::shared_mutex> lock(warningsLock);
259 ✗ warnings.clear();
260 ✗ wakeUpTime = steady_clock::time_point::max();
261 ✗ lock.unlock();
262
263 // Notify Listeners
264 ✗ sema.release();
265 ✗ }
266
267 251062 std::list<FPPWarning> WarningHolder::GetWarnings() {
268
1/2
✓ Branch 0 taken 251062 times.
✗ Branch 1 not taken.
251062 std::shared_lock<std::shared_mutex> lock(warningsLock);
269
1/2
✓ Branch 0 taken 251062 times.
✗ Branch 1 not taken.
502124 return warnings;
270 251062 }
271
272 5809 void PruneWarnings() {
273 // warnings are not stored in a heap or sorted, so we must walk over the warnings to find expired
274
1/2
✓ Branch 0 taken 5809 times.
✗ Branch 1 not taken.
5809 std::unique_lock lock(warningsLock);
275 5809 wakeUpTime = steady_clock::time_point::max();
276
2/2
✓ Branch 0 taken 3043 times.
✓ Branch 1 taken 2766 times.
5809 if (!warnings.empty()) {
277 3043 auto now = steady_clock::now();
278
2/2
✓ Branch 0 taken 5378 times.
✓ Branch 1 taken 3043 times.
8421 for (auto it = warnings.begin(); it != warnings.end(); /* in loop */) {
279
3/4
✓ Branch 0 taken 5378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 5373 times.
5378 if (it->timeout <= now) {
280 // warning has expired
281 5 it = warnings.erase(it);
282 5 continue;
283
3/4
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1750 times.
✓ Branch 3 taken 3623 times.
5373 } else if (it->timeout < wakeUpTime) {
284 // our next warning
285 1750 wakeUpTime = it->timeout;
286 }
287 5373 ++it;
288 }
289 }
290 5809 }
291