0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd::net::dns::cache: Add a mutex around the waiters list manipulations.

This commit is contained in:
Jason Volk 2019-09-10 11:22:21 -07:00
parent 87fd0f04ea
commit b28c5e0573

View file

@ -870,18 +870,33 @@ ircd::net::dns::cache::call_waiters(const string_view &type,
const string_view &state_key,
const json::array &rrs)
{
size_t ret(0);
const ctx::uninterruptible::nothrow ui;
size_t ret(0), last; do
{
waiter *waiter {nullptr};
auto it(begin(waiting));
while(it != end(waiting))
{
auto &waiter(*it);
if(call_waiter(type, state_key, rrs, waiter))
waiter = std::addressof(*it);
if(call_waiter(type, state_key, rrs, *waiter))
break;
++it;
}
last = ret;
for(it = begin(waiting); it != end(waiting); ++it)
{
if(std::addressof(*it) != waiter)
continue;
it = waiting.erase(it);
++ret;
break;
}
else ++it;
}
while(last > ret);
if(ret)
dock.notify_all();