Skip to content

Commit

Permalink
Fix repeated request of channel difference.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Sep 12, 2024
1 parent a5f1209 commit d3bcf63
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Telegram/SourceFiles/api/api_updates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ void Updates::getDifferenceAfterFail() {
wait = wait ? std::min(wait, i->second - now) : (i->second - now);
++i;
} else {
i->first->ptsSetRequesting(false);
getChannelDifference(i->first, ChannelDifferenceRequest::AfterFail);
i = _whenGetDiffAfterFail.erase(i);
}
Expand Down Expand Up @@ -703,7 +704,9 @@ void Updates::getChannelDifference(
_whenGetDiffByPts.remove(channel);
}

if (!channel->ptsInited() || channel->ptsRequesting()) return;
if (!channel->ptsInited() || channel->ptsRequesting()) {
return;
}

if (from != ChannelDifferenceRequest::AfterFail) {
_whenGetDiffAfterFail.remove(channel);
Expand Down Expand Up @@ -1554,6 +1557,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
}
if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
MTP_LOG(0, ("Skipping new channel message because getting the difference."));
return;
}
channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);
Expand Down Expand Up @@ -1646,6 +1650,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {

if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
MTP_LOG(0, ("Skipping channel message edit because getting the difference."));
return;
} else {
channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);
Expand All @@ -1661,6 +1666,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {

if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
MTP_LOG(0, ("Skipping pinned channel messages because getting the difference."));
return;
} else {
channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);
Expand Down Expand Up @@ -1775,6 +1781,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {

if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
MTP_LOG(0, ("Skipping delete channel messages because getting the difference."));
return;
}
channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);
Expand Down Expand Up @@ -1838,6 +1845,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
auto channel = session().data().channelLoaded(d.vchannel_id());
if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
MTP_LOG(0, ("Skipping channel web page update because getting the difference."));
return;
} else {
channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);
Expand Down

0 comments on commit d3bcf63

Please sign in to comment.