Make get_pts/get_qts/get_date private.

This commit is contained in:
levlam 2021-01-16 01:42:06 +03:00
parent ef920f297d
commit 004876dcf0
2 changed files with 23 additions and 24 deletions

View File

@ -135,16 +135,7 @@ class PingServerQuery : public Td::ResultHandler {
class GetDifferenceQuery : public Td::ResultHandler {
public:
void send() {
int32 pts = td->updates_manager_->get_pts();
int32 date = td->updates_manager_->get_date();
int32 qts = td->updates_manager_->get_qts();
if (pts < 0) {
pts = 0;
}
VLOG(get_difference) << tag("pts", pts) << tag("qts", qts) << tag("date", date);
void send(int32 pts, int32 date, int32 qts) {
send_query(G()->net_query_creator().create(telegram_api::updates_getDifference(0, pts, 0, date, qts)));
}
@ -253,7 +244,15 @@ void UpdatesManager::run_get_difference(bool is_recursive, const char *source) {
running_get_difference_ = true;
VLOG(get_difference) << "-----BEGIN GET DIFFERENCE----- from " << source;
int32 pts = get_pts();
int32 date = get_date();
int32 qts = get_qts();
if (pts < 0) {
pts = 0;
}
VLOG(get_difference) << "-----BEGIN GET DIFFERENCE----- from " << source << " with pts = " << pts << ", qts = " << qts
<< ", date = " << date;
before_get_difference(false);
@ -262,9 +261,9 @@ void UpdatesManager::run_get_difference(bool is_recursive, const char *source) {
min_postponed_update_qts_ = 0;
}
td_->create_handler<GetDifferenceQuery>()->send();
last_get_difference_pts_ = get_pts();
last_get_difference_qts_ = get_qts();
td_->create_handler<GetDifferenceQuery>()->send(pts, date, qts);
last_get_difference_pts_ = pts;
last_get_difference_qts_ = qts;
}
void UpdatesManager::before_get_difference(bool is_initial) {

View File

@ -66,16 +66,6 @@ class UpdatesManager : public Actor {
void on_server_pong(tl_object_ptr<telegram_api::updates_state> &&state);
int32 get_pts() const {
return pts_manager_.mem_pts();
}
int32 get_qts() const {
return qts_manager_.mem_pts();
}
int32 get_date() const {
return date_;
}
Promise<> set_pts(int32 pts, const char *source) TD_WARN_UNUSED_RESULT;
bool running_get_difference() const {
@ -161,6 +151,16 @@ class UpdatesManager : public Actor {
void tear_down() override;
int32 get_pts() const {
return pts_manager_.mem_pts();
}
int32 get_qts() const {
return qts_manager_.mem_pts();
}
int32 get_date() const {
return date_;
}
Promise<> add_pts(int32 pts);
void on_pts_ack(PtsManager::PtsId ack_token);
void save_pts(int32 pts);