Add check that RequestHandler sends at most one request.

This commit is contained in:
levlam 2021-11-12 14:47:51 +03:00
parent 4762983803
commit 85c30e5dd2
2 changed files with 3 additions and 0 deletions

View File

@ -160,6 +160,8 @@ void Td::ResultHandler::set_td(Td *td) {
} }
void Td::ResultHandler::send_query(NetQueryPtr query) { void Td::ResultHandler::send_query(NetQueryPtr query) {
CHECK(!is_query_sent_)
is_query_sent_ = true;
td_->add_handler(query->id(), shared_from_this()); td_->add_handler(query->id(), shared_from_this());
query->debug("Send to NetQueryDispatcher"); query->debug("Send to NetQueryDispatcher");
G()->net_query_dispatcher().dispatch(std::move(query)); G()->net_query_dispatcher().dispatch(std::move(query));

View File

@ -227,6 +227,7 @@ class Td final : public Actor {
void send_query(NetQueryPtr query); void send_query(NetQueryPtr query);
Td *td_ = nullptr; Td *td_ = nullptr;
bool is_query_sent_ = false;
private: private:
void set_td(Td *td); void set_td(Td *td);