0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 00:02:34 +01:00

modules/client/keys/claim: Restore when_any() loop to smooth remote handling.

This commit is contained in:
Jason Volk 2023-04-29 10:48:28 -07:00
parent feb4ac1fd3
commit cd2b92b8fe

View file

@ -228,9 +228,29 @@ recv_responses(const host_users_map &map,
}
// remote handle
for(auto &[remote, request] : queries)
while(!queries.empty())
{
assert(!failures.count(remote));
auto next
{
ctx::when_any(begin(queries), end(queries), []
(auto &it) -> m::fed::user::keys::claim &
{
return it->second;
})
};
const bool ok
{
next.wait_until(timeout, std::nothrow)
};
const auto it(next.get());
const unwind remove{[&queries, &it]
{
queries.erase(it);
}};
auto &[remote, request] {*it};
recv_response(remote, request, failures, one_time_keys, timeout);
}
}