Use ClientManager in check_proxy.

This commit is contained in:
levlam 2020-11-13 18:42:47 +03:00
parent 326fd203e9
commit 3efc530fc4

View File

@ -160,20 +160,22 @@ int main(int argc, char **argv) {
SET_VERBOSITY_LEVEL(new_verbosity_level);
td::Client client;
td::ClientManager client_manager;
auto client_id = client_manager.create_client();
for (size_t i = 0; i < requests.size(); i++) {
auto &request = requests[i].second;
request->dc_id_ = dc_id;
request->timeout_ = timeout;
client.send({i + 1, std::move(request)});
client_manager.send(client_id, i + 1, std::move(request));
}
size_t successful_requests = 0;
size_t failed_requests = 0;
while (successful_requests + failed_requests != requests.size()) {
auto response = client.receive(100.0);
if (1 <= response.id && response.id <= requests.size()) {
auto &proxy = requests[static_cast<size_t>(response.id - 1)].first;
auto response = client_manager.receive(100.0);
CHECK(client_id == response.client_id);
if (1 <= response.request_id && response.request_id <= requests.size()) {
auto &proxy = requests[static_cast<size_t>(response.request_id - 1)].first;
if (response.object->get_id() == td::td_api::error::ID) {
LOG(ERROR) << proxy << ": " << to_string(response.object);
failed_requests++;