Rollback offset applying

This commit is contained in:
Eduard Kuzmenko 2022-04-07 15:16:56 +03:00
parent fea9019d8e
commit df3af46377

View File

@ -184,7 +184,7 @@ export default class MTPNetworker {
//private debugRequests: Array<{before: Uint8Array, after: Uint8Array}> = []; //private debugRequests: Array<{before: Uint8Array, after: Uint8Array}> = [];
private delays: typeof delays[keyof typeof delays]; private delays: typeof delays[keyof typeof delays];
private getNewTimeOffset: boolean; // private getNewTimeOffset: boolean;
constructor( constructor(
public dcId: number, public dcId: number,
@ -891,7 +891,7 @@ export default class MTPNetworker {
this.sendPingDelayDisconnect(); this.sendPingDelayDisconnect();
} }
this.getNewTimeOffset = true; // this.getNewTimeOffset = true;
} }
/* if(this.onConnectionStatusChange) { /* if(this.onConnectionStatusChange) {
this.onConnectionStatusChange(this.isOnline); this.onConnectionStatusChange(this.isOnline);
@ -1672,11 +1672,11 @@ export default class MTPNetworker {
this.pingDelayDisconnectDeferred.resolve('any message'); this.pingDelayDisconnectDeferred.resolve('any message');
} }
let changedTimeOffset: boolean; // let changedTimeOffset: boolean;
if(this.getNewTimeOffset) { // if(this.getNewTimeOffset) {
changedTimeOffset = this.applyServerTime(messageId); // changedTimeOffset = this.applyServerTime(messageId);
this.getNewTimeOffset = undefined; // this.getNewTimeOffset = undefined;
} // }
switch(message._) { switch(message._) {
case 'msg_container': { case 'msg_container': {
@ -1719,10 +1719,11 @@ export default class MTPNetworker {
case 32: // * msg_seqno too low case 32: // * msg_seqno too low
case 33: // * msg_seqno too high case 33: // * msg_seqno too high
case 64: { // * invalid container case 64: { // * invalid container
if(changedTimeOffset === undefined) { // if(changedTimeOffset === undefined) {
changedTimeOffset = this.applyServerTime(messageId); // changedTimeOffset = this.applyServerTime(messageId);
} // }
const changedTimeOffset = this.applyServerTime(messageId);
if(message.error_code === 17 || changedTimeOffset) { if(message.error_code === 17 || changedTimeOffset) {
this.log('Update session'); this.log('Update session');
this.updateSession(); this.updateSession();