Improve message_id-parameter names.

This commit is contained in:
levlam 2023-09-21 16:09:19 +03:00
parent 1cd71efb03
commit 7e65c3d4dd
3 changed files with 27 additions and 27 deletions

View File

@ -153,21 +153,21 @@ class PingConnectionPingPong final
return Status::OK();
}
void on_message_ack(uint64 id) final {
void on_message_ack(uint64 message_id) final {
}
Status on_message_result_ok(uint64 id, BufferSlice packet, size_t original_size) final {
Status on_message_result_ok(uint64 message_id, BufferSlice packet, size_t original_size) final {
LOG(ERROR) << "Unexpected message";
return Status::OK();
}
void on_message_result_error(uint64 id, int code, string message) final {
void on_message_result_error(uint64 message_id, int code, string message) final {
}
void on_message_failed(uint64 id, Status status) final {
void on_message_failed(uint64 message_id, Status status) final {
}
void on_message_info(uint64 id, int32 state, uint64 answer_id, int32 answer_size, int32 source) final {
void on_message_info(uint64 message_id, int32 state, uint64 answer_id, int32 answer_size, int32 source) final {
}
Status on_destroy_auth_key() final {

View File

@ -394,8 +394,8 @@ Status SessionConnection::on_packet(const MsgInfo &info, const mtproto_api::bad_
Status SessionConnection::on_packet(const MsgInfo &info, const mtproto_api::msgs_ack &msgs_ack) {
VLOG(mtproto) << "Receive msgs_ack with " << info << ": " << msgs_ack.msg_ids_;
for (auto id : msgs_ack.msg_ids_) {
callback_->on_message_ack(id);
for (auto message_id : msgs_ack.msg_ids_) {
callback_->on_message_ack(message_id);
}
return Status::OK();
}
@ -576,31 +576,31 @@ Status SessionConnection::on_main_packet(const PacketInfo &packet_info, Slice pa
return Status::OK();
}
void SessionConnection::on_message_failed(uint64 id, Status status) {
callback_->on_message_failed(id, std::move(status));
void SessionConnection::on_message_failed(uint64 message_id, Status status) {
callback_->on_message_failed(message_id, std::move(status));
sent_destroy_auth_key_ = false;
if (id == last_ping_message_id_ || id == last_ping_container_message_id_) {
if (message_id == last_ping_message_id_ || message_id == last_ping_container_message_id_) {
// restart ping immediately
last_ping_at_ = 0;
last_ping_message_id_ = 0;
last_ping_container_message_id_ = 0;
}
auto cit = container_to_service_msg_.find(id);
auto cit = container_to_service_msg_.find(message_id);
if (cit != container_to_service_msg_.end()) {
auto message_ids = cit->second;
for (auto message_id : message_ids) {
on_message_failed_inner(message_id);
for (auto inner_message_id : message_ids) {
on_message_failed_inner(inner_message_id);
}
} else {
on_message_failed_inner(id);
on_message_failed_inner(message_id);
}
}
void SessionConnection::on_message_failed_inner(uint64 id) {
auto it = service_queries_.find(id);
void SessionConnection::on_message_failed_inner(uint64 message_id) {
auto it = service_queries_.find(message_id);
if (it == service_queries_.end()) {
return;
}
@ -609,13 +609,13 @@ void SessionConnection::on_message_failed_inner(uint64 id) {
switch (query.type) {
case ServiceQuery::ResendAnswer:
for (auto message_id : query.message_ids) {
resend_answer(message_id);
for (auto query_message_id : query.message_ids) {
resend_answer(query_message_id);
}
break;
case ServiceQuery::GetStateInfo:
for (auto message_id : query.message_ids) {
get_state_info(message_id);
for (auto query_message_id : query.message_ids) {
get_state_info(query_message_id);
}
break;
default:

View File

@ -103,11 +103,11 @@ class SessionConnection final
virtual Status on_update(BufferSlice packet) = 0;
virtual void on_message_ack(uint64 id) = 0;
virtual Status on_message_result_ok(uint64 id, BufferSlice packet, size_t original_size) = 0;
virtual void on_message_result_error(uint64 id, int code, string message) = 0;
virtual void on_message_failed(uint64 id, Status status) = 0;
virtual void on_message_info(uint64 id, int32 state, uint64 answer_id, int32 answer_size, int32 source) = 0;
virtual void on_message_ack(uint64 message_id) = 0;
virtual Status on_message_result_ok(uint64 message_id, BufferSlice packet, size_t original_size) = 0;
virtual void on_message_result_error(uint64 message_id, int code, string message) = 0;
virtual void on_message_failed(uint64 message_id, Status status) = 0;
virtual void on_message_info(uint64 message_id, int32 state, uint64 answer_id, int32 answer_size, int32 source) = 0;
virtual Status on_destroy_auth_key() = 0;
};
@ -254,8 +254,8 @@ class SessionConnection final
Status on_slice_packet(const MsgInfo &info, Slice packet) TD_WARN_UNUSED_RESULT;
Status on_main_packet(const PacketInfo &packet_info, Slice packet) TD_WARN_UNUSED_RESULT;
void on_message_failed(uint64 id, Status status);
void on_message_failed_inner(uint64 id);
void on_message_failed(uint64 message_id, Status status);
void on_message_failed_inner(uint64 message_id);
void do_close(Status status);