Skip to content
Snippets Groups Projects
Commit fcf71118 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

scheduler: avoid possible overflow with buggy stdlib

parent 38ca7b85
No related branches found
No related tags found
No related merge requests found
...@@ -120,7 +120,8 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, DhtRunner::Config ...@@ -120,7 +120,8 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, DhtRunner::Config
} catch (const dht::SocketException& e) { } catch (const dht::SocketException& e) {
startNetwork(local4, local6); startNetwork(local4, local6);
} }
cv.wait_until(lk, wakeup, [this]() {
auto hasJobToDo = [this]() {
if (not running) if (not running)
return true; return true;
{ {
...@@ -137,7 +138,11 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, DhtRunner::Config ...@@ -137,7 +138,11 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, DhtRunner::Config
return true; return true;
} }
return false; return false;
}); };
if (wakeup == time_point::max())
cv.wait(lk, hasJobToDo);
else
cv.wait_until(lk, wakeup, hasJobToDo);
} }
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment