2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

min channels handled, delayed getDifference request with old updDate value added

This commit is contained in:
John Preston
2016-03-11 18:01:32 +03:00
parent 5cab9569c3
commit 02b0512761
3 changed files with 42 additions and 14 deletions

View File

@@ -431,6 +431,7 @@ MainWidget::MainWidget(Window *window) : TWidget(window)
connect(&_idleFinishTimer, SIGNAL(timeout()), this, SLOT(checkIdleFinish()));
connect(&_bySeqTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
connect(&_byPtsTimer, SIGNAL(timeout()), this, SLOT(onGetDifferenceTimeByPts()));
connect(&_byMinChannelTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
connect(&_failDifferenceTimer, SIGNAL(timeout()), this, SLOT(onGetDifferenceTimeAfterFail()));
connect(_api, SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
connect(this, SIGNAL(peerUpdated(PeerData*)), &history, SLOT(peerUpdated(PeerData*)));
@@ -2915,8 +2916,12 @@ bool MainWidget::updateFail(const RPCError &e) {
}
void MainWidget::updSetState(int32 pts, int32 date, int32 qts, int32 seq) {
if (pts) _ptsWaiter.init(pts);
if (updDate < date) updDate = date;
if (pts) {
_ptsWaiter.init(pts);
}
if (updDate < date && !_byMinChannelTimer.isActive()) {
updDate = date;
}
if (qts && updQts < qts) {
updQts = qts;
}
@@ -4507,7 +4512,13 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateNewChannelMessage: {
const MTPDupdateNewChannelMessage &d(update.c_updateNewChannelMessage());
ChannelData *channel = App::channelLoaded(peerToChannel(peerFromMessage(d.vmessage)));
if (!channel && !_ptsWaiter.requesting()) {
MTP_LOG(0, ("getDifference { good - after no channel in updateNewChannelMessage }%1").arg(cTestMode() ? " TESTMODE" : ""));
if (!_byMinChannelTimer.isActive()) { // getDifference after timeout
_byMinChannelTimer.start(WaitForSkippedTimeout);
}
return;
}
if (channel && !_handlingChannelDifference) {
if (channel->ptsRequesting()) { // skip global updates while getting channel difference
return;
@@ -4605,7 +4616,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateChannelTooLong: {
const MTPDupdateChannelTooLong &d(update.c_updateChannelTooLong());
if (ChannelData *channel = App::channelLoaded(d.vchannel_id.v)) {
getChannelDifference(channel);
if (!d.has_pts() || channel->pts() < d.vpts.v) {
getChannelDifference(channel);
}
}
} break;