Use send_closure_later in NetQueryDispatcher to break stack chain.

This commit is contained in:
levlam 2021-09-10 17:42:24 +03:00
parent 2062daf9cd
commit 137543c172

View File

@ -34,10 +34,10 @@ void NetQueryDispatcher::complete_net_query(NetQueryPtr net_query) {
auto callback = net_query->move_callback();
if (callback.empty()) {
net_query->debug("sent to td (no callback)");
send_closure(G()->td(), &NetQueryCallback::on_result, std::move(net_query));
send_closure_later(G()->td(), &Td::on_result, std::move(net_query));
} else {
net_query->debug("sent to callback", true);
send_closure(std::move(callback), &NetQueryCallback::on_result, std::move(net_query));
send_closure_later(std::move(callback), &NetQueryCallback::on_result, std::move(net_query));
}
}