@mtcute/core 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,7 +229,7 @@ export class NetworkManager {
229
229
  _: 'initConnection',
230
230
  deviceModel,
231
231
  systemVersion: '1.0',
232
- appVersion: '0.9.0',
232
+ appVersion: '0.9.1',
233
233
  systemLangCode: 'en',
234
234
  langPack: '',
235
235
  langCode: 'en',
@@ -79,6 +79,13 @@ export class SessionConnection extends PersistentConnection {
79
79
  prom.reject(new MtcuteError('Connection closed'));
80
80
  clearTimeout(timeout);
81
81
  });
82
+ // resend pending state_req-s
83
+ for (const msgId of this._session.pendingMessages.keys()) {
84
+ const pending = this._session.pendingMessages.get(msgId);
85
+ if (pending._ === 'state') {
86
+ this._onMessageFailed(msgId, 'connection loss', true);
87
+ }
88
+ }
82
89
  this.emit('disconnect');
83
90
  this.reset();
84
91
  }
@@ -922,6 +929,7 @@ export class SessionConnection extends PersistentConnection {
922
929
  this.log.warn('received msgs_state_info to %s query %l', info._, msg.reqMsgId);
923
930
  return;
924
931
  }
932
+ this._session.pendingMessages.delete(msg.reqMsgId);
925
933
  this._onMessagesInfo(info.msgIds, msg.info);
926
934
  }
927
935
  _onFutureSalts(msg) {
@@ -934,6 +942,7 @@ export class SessionConnection extends PersistentConnection {
934
942
  this.log.warn('received future_salts to %s query %l', info._, msg.reqMsgId);
935
943
  return;
936
944
  }
945
+ this._session.pendingMessages.delete(msg.reqMsgId);
937
946
  this.log.debug('received future_salts: %d salts', msg.salts.length);
938
947
  this._salts.isFetching = false;
939
948
  this._salts.setFutureSalts(msg.salts.slice());