Ensure that all network requests are sent and all their responses are processed asynchronously.
This commit is contained in:
parent
08ce44a194
commit
d29c86bb14
@ -77,7 +77,7 @@ void SequenceDispatcher::try_resend_query(Data &data, NetQueryPtr query) {
|
|||||||
// TODO: if query is ok, use NetQueryCallback::on_result
|
// TODO: if query is ok, use NetQueryCallback::on_result
|
||||||
if (data.callback_.empty()) {
|
if (data.callback_.empty()) {
|
||||||
do_finish(data);
|
do_finish(data);
|
||||||
send_closure(G()->td(), &Td::on_result, std::move(query));
|
send_closure_later(G()->td(), &Td::on_result, std::move(query));
|
||||||
loop();
|
loop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ class MultiSequenceDispatcherImpl final : public MultiSequenceDispatcher {
|
|||||||
if (node.callback.empty()) {
|
if (node.callback.empty()) {
|
||||||
auto query = std::move(node.net_query);
|
auto query = std::move(node.net_query);
|
||||||
scheduler_.finish_task(task_id);
|
scheduler_.finish_task(task_id);
|
||||||
send_closure(G()->td(), &Td::on_result, std::move(query));
|
send_closure_later(G()->td(), &Td::on_result, std::move(query));
|
||||||
loop();
|
loop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
|
|||||||
|
|
||||||
if (!net_query->in_sequence_dispatcher() && !net_query->get_chain_ids().empty()) {
|
if (!net_query->in_sequence_dispatcher() && !net_query->get_chain_ids().empty()) {
|
||||||
net_query->debug("sent to main sequence dispatcher");
|
net_query->debug("sent to main sequence dispatcher");
|
||||||
send_closure(sequence_dispatcher_, &MultiSequenceDispatcher::send, std::move(net_query));
|
send_closure_later(sequence_dispatcher_, &MultiSequenceDispatcher::send, std::move(net_query));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
|
|||||||
net_query->resend();
|
net_query->resend();
|
||||||
} else if (code < 0 || code == 500 || code == 420) {
|
} else if (code < 0 || code == 500 || code == 420) {
|
||||||
net_query->debug("sent to NetQueryDelayer");
|
net_query->debug("sent to NetQueryDelayer");
|
||||||
return send_closure(delayer_, &NetQueryDelayer::delay, std::move(net_query));
|
return send_closure_later(delayer_, &NetQueryDelayer::delay, std::move(net_query));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user