@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.
@@ -233,7 +233,7 @@ class NetworkManager {
233
233
  _: 'initConnection',
234
234
  deviceModel,
235
235
  systemVersion: '1.0',
236
- appVersion: '0.9.0',
236
+ appVersion: '0.9.1',
237
237
  systemLangCode: 'en',
238
238
  langPack: '',
239
239
  langCode: 'en',
@@ -85,6 +85,13 @@ class SessionConnection extends persistent_connection_js_1.PersistentConnection
85
85
  prom.reject(new index_js_1.MtcuteError('Connection closed'));
86
86
  clearTimeout(timeout);
87
87
  });
88
+ // resend pending state_req-s
89
+ for (const msgId of this._session.pendingMessages.keys()) {
90
+ const pending = this._session.pendingMessages.get(msgId);
91
+ if (pending._ === 'state') {
92
+ this._onMessageFailed(msgId, 'connection loss', true);
93
+ }
94
+ }
88
95
  this.emit('disconnect');
89
96
  this.reset();
90
97
  }
@@ -928,6 +935,7 @@ class SessionConnection extends persistent_connection_js_1.PersistentConnection
928
935
  this.log.warn('received msgs_state_info to %s query %l', info._, msg.reqMsgId);
929
936
  return;
930
937
  }
938
+ this._session.pendingMessages.delete(msg.reqMsgId);
931
939
  this._onMessagesInfo(info.msgIds, msg.info);
932
940
  }
933
941
  _onFutureSalts(msg) {
@@ -940,6 +948,7 @@ class SessionConnection extends persistent_connection_js_1.PersistentConnection
940
948
  this.log.warn('received future_salts to %s query %l', info._, msg.reqMsgId);
941
949
  return;
942
950
  }
951
+ this._session.pendingMessages.delete(msg.reqMsgId);
943
952
  this.log.debug('received future_salts: %d salts', msg.salts.length);
944
953
  this._salts.isFetching = false;
945
954
  this._salts.setFutureSalts(msg.salts.slice());