Fix applying of postponed pts updates after pts repair.
This commit is contained in:
parent
1787574262
commit
b4b9ff563f
@ -6396,8 +6396,8 @@ void MessagesManager::skip_old_pending_pts_update(tl_object_ptr<telegram_api::Up
|
|||||||
auto update_new_message = static_cast<telegram_api::updateNewMessage *>(update.get());
|
auto update_new_message = static_cast<telegram_api::updateNewMessage *>(update.get());
|
||||||
auto full_message_id = get_full_message_id(update_new_message->message_, false);
|
auto full_message_id = get_full_message_id(update_new_message->message_, false);
|
||||||
if (update_message_ids_.count(full_message_id) > 0) {
|
if (update_message_ids_.count(full_message_id) > 0) {
|
||||||
if (new_pts == old_pts) { // otherwise message can be already deleted
|
if (new_pts == old_pts || old_pts == std::numeric_limits<int32>::max()) {
|
||||||
// apply sent message anyway
|
// apply sent message anyway if it is definitely non-deleted or being skipped because of pts overflow
|
||||||
on_get_message(std::move(update_new_message->message_), true, false, false, true, true,
|
on_get_message(std::move(update_new_message->message_), true, false, false, true, true,
|
||||||
"updateNewMessage with an awaited message");
|
"updateNewMessage with an awaited message");
|
||||||
return;
|
return;
|
||||||
@ -6411,8 +6411,8 @@ void MessagesManager::skip_old_pending_pts_update(tl_object_ptr<telegram_api::Up
|
|||||||
if (update->get_id() == updateSentMessage::ID) {
|
if (update->get_id() == updateSentMessage::ID) {
|
||||||
auto update_sent_message = static_cast<updateSentMessage *>(update.get());
|
auto update_sent_message = static_cast<updateSentMessage *>(update.get());
|
||||||
if (being_sent_messages_.count(update_sent_message->random_id_) > 0) {
|
if (being_sent_messages_.count(update_sent_message->random_id_) > 0) {
|
||||||
if (new_pts == old_pts) { // otherwise message can be already deleted
|
if (new_pts == old_pts || old_pts == std::numeric_limits<int32>::max()) {
|
||||||
// apply sent message anyway
|
// apply sent message anyway if it is definitely non-deleted or being skipped because of pts overflow
|
||||||
on_send_message_success(update_sent_message->random_id_, update_sent_message->message_id_,
|
on_send_message_success(update_sent_message->random_id_, update_sent_message->message_id_,
|
||||||
update_sent_message->date_, update_sent_message->ttl_period_, FileId(),
|
update_sent_message->date_, update_sent_message->ttl_period_, FileId(),
|
||||||
"process old updateSentMessage");
|
"process old updateSentMessage");
|
||||||
|
@ -1063,7 +1063,10 @@ void UpdatesManager::on_get_updates_state(tl_object_ptr<telegram_api::updates_st
|
|||||||
LOG(WARNING) << "Restore pts to " << state->pts_;
|
LOG(WARNING) << "Restore pts to " << state->pts_;
|
||||||
// restoring right pts
|
// restoring right pts
|
||||||
CHECK(pending_pts_updates_.empty());
|
CHECK(pending_pts_updates_.empty());
|
||||||
|
auto real_running_get_difference = running_get_difference_;
|
||||||
|
running_get_difference_ = false;
|
||||||
process_postponed_pts_updates(); // drop all updates with old pts
|
process_postponed_pts_updates(); // drop all updates with old pts
|
||||||
|
running_get_difference_ = real_running_get_difference;
|
||||||
pts_manager_.init(state->pts_);
|
pts_manager_.init(state->pts_);
|
||||||
last_get_difference_pts_ = get_pts();
|
last_get_difference_pts_ = get_pts();
|
||||||
last_pts_save_time_ = Time::now() - 2 * MAX_PTS_SAVE_DELAY;
|
last_pts_save_time_ = Time::now() - 2 * MAX_PTS_SAVE_DELAY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user