mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
sending ping_delay_disconnect instead of getDifference by no-updates timeouts
This commit is contained in:
@@ -360,7 +360,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr
|
||||
connect(&dialogs, SIGNAL(cancelled()), this, SLOT(dialogsCancelled()));
|
||||
connect(&history, SIGNAL(cancelled()), &dialogs, SLOT(activate()));
|
||||
connect(this, SIGNAL(peerPhotoChanged(PeerData*)), this, SIGNAL(dialogsUpdated()));
|
||||
connect(&noUpdatesTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
|
||||
connect(&noUpdatesTimer, SIGNAL(timeout()), this, SLOT(mtpPing()));
|
||||
connect(&_onlineTimer, SIGNAL(timeout()), this, SLOT(updateOnline()));
|
||||
connect(&_onlineUpdater, SIGNAL(timeout()), this, SLOT(updateOnlineDisplay()));
|
||||
connect(&_idleFinishTimer, SIGNAL(timeout()), this, SLOT(checkIdleFinish()));
|
||||
@@ -1195,7 +1195,8 @@ void MainWidget::peerUsernameChanged(PeerData *peer) {
|
||||
void MainWidget::checkLastUpdate(bool afterSleep) {
|
||||
uint64 n = getms(true);
|
||||
if (_lastUpdateTime && n > _lastUpdateTime + (afterSleep ? NoUpdatesAfterSleepTimeout : NoUpdatesTimeout)) {
|
||||
getDifference();
|
||||
_lastUpdateTime = n;
|
||||
MTP::ping();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2398,6 +2399,10 @@ void MainWidget::getDifference() {
|
||||
MTP::send(MTPupdates_GetDifference(MTP_int(updGoodPts), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference));
|
||||
}
|
||||
|
||||
void MainWidget::mtpPing() {
|
||||
MTP::ping();
|
||||
}
|
||||
|
||||
void MainWidget::start(const MTPUser &user) {
|
||||
int32 uid = user.c_userSelf().vid.v;
|
||||
if (MTP::authedId() != uid) {
|
||||
@@ -2805,6 +2810,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
|
||||
case mtpc_updateShortMessage: {
|
||||
const MTPDupdateShortMessage &d(updates.c_updateShortMessage());
|
||||
if (!App::userLoaded(d.vuser_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) {
|
||||
DEBUG_LOG(("Not loaded for updateShortMessage, good getDifference!"));
|
||||
return getDifference();
|
||||
}
|
||||
if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||
@@ -2823,6 +2829,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
|
||||
case mtpc_updateShortChatMessage: {
|
||||
const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage());
|
||||
if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) {
|
||||
DEBUG_LOG(("Not loaded for updateShortMessage, good getDifference!"));
|
||||
return getDifference();
|
||||
}
|
||||
if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||
|
Reference in New Issue
Block a user