Session: force ack when we received unknown answer

This commit is contained in:
Arseny Smirnov 2022-05-03 17:17:14 +04:00
parent fb1efdbba8
commit 852fe4f24b
3 changed files with 8 additions and 0 deletions

View File

@ -838,6 +838,12 @@ std::pair<uint64, BufferSlice> SessionConnection::encrypted_bind(int64 perm_key,
return std::make_pair(query.message_id, packet.as_buffer_slice());
}
void SessionConnection::force_ack() {
if (!to_ack_.empty()) {
send_before(Time::now_cached());
}
}
void SessionConnection::send_ack(uint64 message_id) {
VLOG(mtproto) << "Send ack: [msg_id:" << format::as_hex(message_id) << "]";
if (to_ack_.empty()) {

View File

@ -91,6 +91,7 @@ class SessionConnection final
void destroy_key();
void set_online(bool online_flag, bool is_main);
void force_ack();
class Callback {
public:

View File

@ -871,6 +871,7 @@ void Session::on_message_result_error(uint64 id, int error_code, string message)
}
auto it = sent_queries_.find(id);
if (it == sent_queries_.end()) {
current_info_->connection_->force_ack();
return;
}