Skip to content

Commit

Permalink
Session: force ack when we received unknown answer
Browse files Browse the repository at this point in the history
  • Loading branch information
arseny30 committed May 3, 2022
1 parent fb1efdb commit 852fe4f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions td/mtproto/SessionConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
1 change: 1 addition & 0 deletions td/mtproto/SessionConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions td/telegram/net/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 852fe4f

Please sign in to comment.