Improve names of some variables.

This commit is contained in:
levlam 2023-04-03 01:24:43 +03:00
parent 375a024585
commit fb4d0daa2f
5 changed files with 23 additions and 22 deletions

View File

@ -107,29 +107,29 @@ class CancelVectorImpl {
class InvokeAfter {
public:
explicit InvokeAfter(Span<uint64> ids) : ids_(ids) {
explicit InvokeAfter(Span<uint64> message_ids) : message_ids_(message_ids) {
}
template <class StorerT>
void store(StorerT &storer) const {
if (ids_.empty()) {
if (message_ids_.empty()) {
return;
}
if (ids_.size() == 1) {
if (message_ids_.size() == 1) {
storer.store_int(static_cast<int32>(0xcb9f372d));
storer.store_long(static_cast<int64>(ids_[0]));
storer.store_long(static_cast<int64>(message_ids_[0]));
return;
}
// invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
storer.store_int(static_cast<int32>(0x3dc4b4f0));
storer.store_int(static_cast<int32>(0x1cb5c415));
storer.store_int(narrow_cast<int32>(ids_.size()));
for (auto id : ids_) {
storer.store_long(static_cast<int64>(id));
storer.store_int(narrow_cast<int32>(message_ids_.size()));
for (auto message_id : message_ids_) {
storer.store_long(static_cast<int64>(message_id));
}
}
private:
Span<uint64> ids_;
Span<uint64> message_ids_;
};
class QueryImpl {

View File

@ -420,13 +420,14 @@ Status SessionConnection::on_packet(const MsgInfo &info, const mtproto_api::futu
return Status::OK();
}
Status SessionConnection::on_msgs_state_info(const vector<int64> &ids, Slice info) {
if (ids.size() != info.size()) {
return Status::Error(PSLICE() << tag("ids.size()", ids.size()) << " != " << tag("info.size()", info.size()));
Status SessionConnection::on_msgs_state_info(const vector<int64> &message_ids, Slice info) {
if (message_ids.size() != info.size()) {
return Status::Error(PSLICE() << tag("message count", message_ids.size())
<< " != " << tag("info.size()", info.size()));
}
size_t i = 0;
for (auto id : ids) {
callback_->on_message_info(id, info[i], 0, 0);
for (auto message_id : message_ids) {
callback_->on_message_info(message_id, info[i], 0, 0);
i++;
}
return Status::OK();
@ -956,7 +957,7 @@ void SessionConnection::flush_packet() {
return result;
};
// no more than 8192 ids per container..
// no more than 8192 message identifiers per container..
auto to_resend_answer = cut_tail(to_resend_answer_, 8192, "resend_answer");
uint64 resend_answer_id = 0;
CHECK(queries.size() <= 1020);
@ -994,14 +995,14 @@ void SessionConnection::flush_packet() {
}
if (container_id != 0) {
vector<uint64> ids = transform(queries, [](const MtprotoQuery &x) { return static_cast<uint64>(x.message_id); });
auto message_ids = transform(queries, [](const MtprotoQuery &x) { return static_cast<uint64>(x.message_id); });
// some acks may be lost here. Nobody will resend them if something goes wrong with query.
// It is mostly problem for server. We will just drop this answers in next connection
//
// get future salt too.
// So I will re-ask salt if have no answer in 60 second.
callback_->on_container_sent(container_id, std::move(ids));
callback_->on_container_sent(container_id, std::move(message_ids));
if (resend_answer_id) {
container_to_service_msg_[container_id].push_back(resend_answer_id);

View File

@ -243,7 +243,7 @@ class SessionConnection final
Status on_packet(const MsgInfo &info, const mtproto_api::pong &pong) TD_WARN_UNUSED_RESULT;
Status on_packet(const MsgInfo &info, const mtproto_api::future_salts &salts) TD_WARN_UNUSED_RESULT;
Status on_msgs_state_info(const vector<int64> &ids, Slice info) TD_WARN_UNUSED_RESULT;
Status on_msgs_state_info(const vector<int64> &message_ids, Slice info) TD_WARN_UNUSED_RESULT;
Status on_packet(const MsgInfo &info, const mtproto_api::msgs_state_info &msgs_state_info) TD_WARN_UNUSED_RESULT;
Status on_packet(const MsgInfo &info, const mtproto_api::msgs_all_info &msgs_all_info) TD_WARN_UNUSED_RESULT;
Status on_packet(const MsgInfo &info, const mtproto_api::msg_detailed_info &msg_detailed_info) TD_WARN_UNUSED_RESULT;

View File

@ -129,7 +129,7 @@ void FileData::parse(ParserT &parser, bool register_file_sources) {
}
}
} else {
parser.set_error("Wrong number of file source ids");
parser.set_error("Wrong number of file source identifiers");
}
}
}

View File

@ -107,13 +107,13 @@ class TempAuthKeyWatchdog final : public NetQueryCallback {
need_sync_ = false;
run_sync_ = true;
sync_at_ = 0;
vector<int64> ids;
vector<int64> auth_key_ids;
for (auto &id_count : id_count_) {
ids.push_back(id_count.first);
auth_key_ids.push_back(id_count.first);
}
if (!G()->close_flag()) {
LOG(WARNING) << "Start auth_dropTempAuthKeys except keys " << format::as_array(ids);
auto query = G()->net_query_creator().create_unauth(telegram_api::auth_dropTempAuthKeys(std::move(ids)));
LOG(WARNING) << "Start auth_dropTempAuthKeys except keys " << format::as_array(auth_key_ids);
auto query = G()->net_query_creator().create_unauth(telegram_api::auth_dropTempAuthKeys(std::move(auth_key_ids)));
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
}
}