Fixed getDiff after new session create

This commit is contained in:
Igor Zhukov 2014-10-30 11:38:07 +03:00
parent 542affc671
commit 08ab86fe86
3 changed files with 13 additions and 8 deletions

View File

@ -151,7 +151,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
lastMessageID = messageID; lastMessageID = messageID;
// console.log('generated msg id', messageID); // console.log('generated msg id', messageID, timeOffset);
return longFromInts(messageID[0], messageID[1]); return longFromInts(messageID[0], messageID[1]);
}; };
@ -1321,10 +1321,6 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
this.nextReq = nextReq; this.nextReq = nextReq;
}; };
MtpNetworker.prototype.onSessionCreate = function (sessionID, messageID) {
// console.log(dT(), 'New session created', bytesToHex(sessionID));
};
MtpNetworker.prototype.ackMessage = function (msgID) { MtpNetworker.prototype.ackMessage = function (msgID) {
// console.log('ack message', msgID); // console.log('ack message', msgID);
this.pendingAcks.push(msgID); this.pendingAcks.push(msgID);
@ -1445,7 +1441,13 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
this.processMessageAck(message.first_msg_id); this.processMessageAck(message.first_msg_id);
this.applyServerSalt(message.server_salt); this.applyServerSalt(message.server_salt);
this.onSessionCreate(sessionID, messageID);
var self = this;
Storage.get('dc').then(function (baseDcID) {
if (baseDcID == self.dcID && !self.upload && updatesProcessor) {
updatesProcessor(message);
}
});
break; break;
case 'msgs_ack': case 'msgs_ack':

View File

@ -61,7 +61,7 @@ function onContentLoaded (cb) {
}; };
function tsNow (seconds) { function tsNow (seconds) {
var t = +new Date(); var t = +new Date() + (window.tsOffset || 0);
return seconds ? Math.floor(t / 1000) : t; return seconds ? Math.floor(t / 1000) : t;
} }

View File

@ -2936,6 +2936,7 @@ angular.module('myApp.services', ['myApp.i18n'])
switch (updateMessage._) { switch (updateMessage._) {
case 'updatesTooLong': case 'updatesTooLong':
case 'new_session_created':
forceGetDifference(); forceGetDifference();
break; break;
@ -3133,7 +3134,9 @@ angular.module('myApp.services', ['myApp.i18n'])
curState.seq = stateResult.seq; curState.seq = stateResult.seq;
curState.pts = stateResult.pts; curState.pts = stateResult.pts;
curState.date = stateResult.date; curState.date = stateResult.date;
isSynchronizing = false; setTimeout(function () {
isSynchronizing = false;
}, 1000);
}) })
} }