diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 48e275cad..0ba1113c5 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -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()->send(); - last_get_difference_pts_ = get_pts(); - last_get_difference_qts_ = get_qts(); + td_->create_handler()->send(pts, date, qts); + last_get_difference_pts_ = pts; + last_get_difference_qts_ = qts; } void UpdatesManager::before_get_difference(bool is_initial) { diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index 4fc3c8be5..54500aae3 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -66,16 +66,6 @@ class UpdatesManager : public Actor { void on_server_pong(tl_object_ptr &&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);