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:
parent
feb4ac1fd3
commit
cd2b92b8fe
1 changed files with 22 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue