Remove PacketInfo.size.

This commit is contained in:
levlam 2023-09-09 23:51:40 +03:00
parent 4a36186662
commit 4da0f76d2a
2 changed files with 2 additions and 8 deletions

View File

@ -25,7 +25,6 @@ struct PacketInfo {
bool is_creator{false};
bool check_mod4{true};
bool use_random_padding{false};
uint32 size{0};
};
} // namespace mtproto

View File

@ -187,18 +187,13 @@ size_t do_calc_crypto_size2_rand(size_t data_size, size_t enc_size, size_t raw_s
template <class HeaderT>
size_t Transport::calc_crypto_size2(size_t data_size, PacketInfo *info) {
if (info->size != 0) {
return info->size;
}
size_t enc_size = HeaderT::encrypted_header_size();
size_t raw_size = sizeof(HeaderT) - enc_size;
if (info->use_random_padding) {
info->size = narrow_cast<uint32>(do_calc_crypto_size2_rand(data_size, enc_size, raw_size));
return do_calc_crypto_size2_rand(data_size, enc_size, raw_size);
} else {
info->size = narrow_cast<uint32>(do_calc_crypto_size2_basic(data_size, enc_size, raw_size));
return do_calc_crypto_size2_basic(data_size, enc_size, raw_size);
}
return info->size;
}
size_t Transport::calc_no_crypto_size(size_t data_size) {