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
1 changed files with 22 additions and 2 deletions

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);
}
}