@mtkruto/node 0.2.6 → 0.2.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"2_update_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_update_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAqB,KAAK,EAA2B,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,GAAG,EAA4D,UAAU,EAAE,MAAM,YAAY,CAAC;AAGvG,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,sBAAsB,GAC1B,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,0BAA0B,GAC9B,GAAG,CAAC,aAAa,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GACxB,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,CAAC;AAE7B,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,yBAAyB,GAC7B,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,4BAA4B,GAChC,GAAG,CAAC,kBAAkB,GACtB,GAAG,CAA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AC,EAAE,CAAC;IAWhB,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI,gBAAgB;IAuCvE,UAAU,CAAC,MAAM,EAAE,MAAM;IAkBzB,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE;IAgB9B,aAAa,CAAC,MAAM,EAAE,UAAU;IAqGhC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE;IAepC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IA2JlC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,CAAC,SAAS,GAAG,IAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;IAuMvH,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAmLrC,gBAAgB,CAAC,OAAO,EAAE,aAAa;CAMxC"}
@@ -28,9 +28,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
28
28
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
29
29
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
30
  };
31
- var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
31
+ var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoveringUpdateGap, _UpdateManager_recoverUpdateGapMutex, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
32
32
  import { unreachable } from "../0_deps.js";
33
- import { getLogger, Queue, second, ZERO_CHANNEL_ID } from "../1_utilities.js";
33
+ import { getLogger, Mutex, Queue, second, ZERO_CHANNEL_ID } from "../1_utilities.js";
34
34
  import { as, inputPeerToPeer, is, isOfEnum, isOneOf, peerToChatId } from "../2_tl.js";
35
35
  import { PersistentTimestampInvalid } from "../3_errors.js";
36
36
  import { CHANNEL_DIFFERENCE_LIMIT_BOT, CHANNEL_DIFFERENCE_LIMIT_USER } from "../4_constants.js";
@@ -53,6 +53,8 @@ export class UpdateManager {
53
53
  _UpdateManager_ptsUpdateQueue.set(this, new Queue("ptsUpdate"));
54
54
  _UpdateManager_qtsUpdateQueue.set(this, new Queue("qtsUpdate"));
55
55
  _UpdateManager_processUpdatesQueue.set(this, new Queue("UpdateManager/processUpdates"));
56
+ _UpdateManager_recoveringUpdateGap.set(this, false);
57
+ _UpdateManager_recoverUpdateGapMutex.set(this, new Mutex());
56
58
  _UpdateManager_handleUpdatesSet.set(this, new Set());
57
59
  __classPrivateFieldSet(this, _UpdateManager_c, c, "f");
58
60
  const L = getLogger("UpdateManager").client(c.id);
@@ -238,6 +240,14 @@ export class UpdateManager {
238
240
  if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
239
241
  return;
240
242
  }
243
+ const wasRecoveringUpdateGap = __classPrivateFieldGet(this, _UpdateManager_recoveringUpdateGap, "f");
244
+ const unlock = await __classPrivateFieldGet(this, _UpdateManager_recoverUpdateGapMutex, "f").lock();
245
+ if (wasRecoveringUpdateGap) {
246
+ __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug(`update gap was just recovered [${source}]`);
247
+ unlock();
248
+ return;
249
+ }
250
+ __classPrivateFieldSet(this, _UpdateManager_recoveringUpdateGap, true, "f");
241
251
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug(`recovering from update gap [${source}]`);
242
252
  __classPrivateFieldGet(this, _UpdateManager_c, "f").setConnectionState("updating");
243
253
  try {
@@ -303,7 +313,9 @@ export class UpdateManager {
303
313
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").error(err);
304
314
  }
305
315
  finally {
316
+ unlock();
306
317
  __classPrivateFieldGet(this, _UpdateManager_c, "f").resetConnectionState();
318
+ __classPrivateFieldSet(this, _UpdateManager_recoveringUpdateGap, false, "f");
307
319
  }
308
320
  }
309
321
  setUpdateHandler(handler) {
@@ -313,7 +325,7 @@ export class UpdateManager {
313
325
  __classPrivateFieldSet(this, _UpdateManager_updateHandler, handler, "f");
314
326
  }
315
327
  }
316
- _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_qtsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
328
+ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_qtsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_recoveringUpdateGap = new WeakMap(), _UpdateManager_recoverUpdateGapMutex = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
317
329
  if (typeof __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates === "boolean") {
318
330
  return __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates;
319
331
  }
@@ -747,13 +747,13 @@ export class Client extends Composer {
747
747
  */
748
748
  async connect() {
749
749
  const unlock = await __classPrivateFieldGet(this, _Client_connectMutex, "f").lock();
750
- if (this.connected) {
751
- return;
752
- }
753
- if (__classPrivateFieldGet(this, _Client_lastConnect, "f") != null && Date.now() - __classPrivateFieldGet(this, _Client_lastConnect, "f").getTime() <= 10 * second) {
754
- await new Promise((r) => setTimeout(r, 3 * second));
755
- }
756
750
  try {
751
+ if (this.connected) {
752
+ return;
753
+ }
754
+ if (__classPrivateFieldGet(this, _Client_lastConnect, "f") != null && Date.now() - __classPrivateFieldGet(this, _Client_lastConnect, "f").getTime() <= 10 * second) {
755
+ await new Promise((r) => setTimeout(r, 3 * second));
756
+ }
757
757
  await __classPrivateFieldGet(this, _Client_instances, "m", _Client_initStorage).call(this);
758
758
  const [authKey, dc] = await Promise.all([this.storage.getAuthKey(), this.storage.getDc()]);
759
759
  if (authKey != null && dc != null) {
@@ -1 +1 @@
1
- {"version":3,"file":"1_connection_tcp.d.ts","sourceRoot":"","sources":["../../src/connection/1_connection_tcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,aAAc,YAAW,UAAU;;IAU9C,OAAO,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAwB;IAC5D,kBAAkB,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK1C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAQK,IAAI;IA+CJ,IAAI,CAAC,CAAC,EAAE,UAAU;IAgBlB,KAAK,CAAC,CAAC,EAAE,UAAU;IA0BzB,KAAK;CAON"}
1
+ {"version":3,"file":"1_connection_tcp.d.ts","sourceRoot":"","sources":["../../src/connection/1_connection_tcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAM5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,aAAc,YAAW,UAAU;;IAU9C,OAAO,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAwB;IAC5D,kBAAkB,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK1C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAQK,IAAI;IA+CJ,IAAI,CAAC,CAAC,EAAE,UAAU;IAgBlB,KAAK,CAAC,CAAC,EAAE,UAAU;IA4BzB,KAAK;CAON"}
@@ -31,6 +31,7 @@ var _ConnectionTCP_instances, _ConnectionTCP_hostname, _ConnectionTCP_port, _Con
31
31
  */
32
32
  import * as dntShim from "../_dnt.shims.js";
33
33
  import { concat, iterateReader } from "../0_deps.js";
34
+ import { ConnectionError } from "../0_errors.js";
34
35
  import { getLogger, Mutex } from "../1_utilities.js";
35
36
  const L = getLogger("ConnectionTCP");
36
37
  export class ConnectionTCP {
@@ -140,8 +141,11 @@ export class ConnectionTCP {
140
141
  }
141
142
  if (!this.connected) {
142
143
  this.stateChangeHandler?.(false);
144
+ throw new ConnectionError("Connection was closed");
145
+ }
146
+ else {
147
+ throw err;
143
148
  }
144
- throw err;
145
149
  }
146
150
  }
147
151
  }
@@ -159,11 +163,11 @@ export class ConnectionTCP {
159
163
  }
160
164
  _ConnectionTCP_hostname = new WeakMap(), _ConnectionTCP_port = new WeakMap(), _ConnectionTCP_connection = new WeakMap(), _ConnectionTCP_rMutex = new WeakMap(), _ConnectionTCP_wMutex = new WeakMap(), _ConnectionTCP_buffer = new WeakMap(), _ConnectionTCP_nextResolve = new WeakMap(), _ConnectionTCP_canRead = new WeakMap(), _ConnectionTCP_canWrite = new WeakMap(), _ConnectionTCP_instances = new WeakSet(), _ConnectionTCP_assertConnected = function _ConnectionTCP_assertConnected() {
161
165
  if (!this.connected) {
162
- throw new Error("Connection not open");
166
+ throw new ConnectionError("Connection not open");
163
167
  }
164
168
  }, _ConnectionTCP_rejectRead = function _ConnectionTCP_rejectRead() {
165
169
  if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null) {
166
- __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(new Error("Connection was closed"));
170
+ __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(new ConnectionError("Connection was closed"));
167
171
  __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
168
172
  }
169
173
  };
@@ -34,7 +34,7 @@ import { concat, unreachable } from "../0_deps.js";
34
34
  import { ConnectionError } from "../0_errors.js";
35
35
  import { getLogger, Mutex } from "../1_utilities.js";
36
36
  const L = getLogger("ConnectionWebSocket");
37
- const errConnectionNotOpen = new Error("Connection not open");
37
+ const errConnectionNotOpen = new ConnectionError("Connection not open");
38
38
  export class ConnectionWebSocket {
39
39
  constructor(url) {
40
40
  _ConnectionWebSocket_instances.add(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version":3,"file":"2_update_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_update_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAqB,KAAK,EAA2B,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,GAAG,EAA4D,UAAU,EAAE,MAAM,YAAY,CAAC;AAGvG,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,sBAAsB,GAC1B,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC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7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
29
29
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
30
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
31
  };
32
- var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
32
+ var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoveringUpdateGap, _UpdateManager_recoverUpdateGapMutex, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.UpdateManager = void 0;
35
35
  const _0_deps_js_1 = require("../0_deps.js");
@@ -56,6 +56,8 @@ class UpdateManager {
56
56
  _UpdateManager_ptsUpdateQueue.set(this, new _1_utilities_js_1.Queue("ptsUpdate"));
57
57
  _UpdateManager_qtsUpdateQueue.set(this, new _1_utilities_js_1.Queue("qtsUpdate"));
58
58
  _UpdateManager_processUpdatesQueue.set(this, new _1_utilities_js_1.Queue("UpdateManager/processUpdates"));
59
+ _UpdateManager_recoveringUpdateGap.set(this, false);
60
+ _UpdateManager_recoverUpdateGapMutex.set(this, new _1_utilities_js_1.Mutex());
59
61
  _UpdateManager_handleUpdatesSet.set(this, new Set());
60
62
  __classPrivateFieldSet(this, _UpdateManager_c, c, "f");
61
63
  const L = (0, _1_utilities_js_1.getLogger)("UpdateManager").client(c.id);
@@ -241,6 +243,14 @@ class UpdateManager {
241
243
  if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
242
244
  return;
243
245
  }
246
+ const wasRecoveringUpdateGap = __classPrivateFieldGet(this, _UpdateManager_recoveringUpdateGap, "f");
247
+ const unlock = await __classPrivateFieldGet(this, _UpdateManager_recoverUpdateGapMutex, "f").lock();
248
+ if (wasRecoveringUpdateGap) {
249
+ __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug(`update gap was just recovered [${source}]`);
250
+ unlock();
251
+ return;
252
+ }
253
+ __classPrivateFieldSet(this, _UpdateManager_recoveringUpdateGap, true, "f");
244
254
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug(`recovering from update gap [${source}]`);
245
255
  __classPrivateFieldGet(this, _UpdateManager_c, "f").setConnectionState("updating");
246
256
  try {
@@ -306,7 +316,9 @@ class UpdateManager {
306
316
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").error(err);
307
317
  }
308
318
  finally {
319
+ unlock();
309
320
  __classPrivateFieldGet(this, _UpdateManager_c, "f").resetConnectionState();
321
+ __classPrivateFieldSet(this, _UpdateManager_recoveringUpdateGap, false, "f");
310
322
  }
311
323
  }
312
324
  setUpdateHandler(handler) {
@@ -317,7 +329,7 @@ class UpdateManager {
317
329
  }
318
330
  }
319
331
  exports.UpdateManager = UpdateManager;
320
- _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_qtsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
332
+ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_qtsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_recoveringUpdateGap = new WeakMap(), _UpdateManager_recoverUpdateGapMutex = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
321
333
  if (typeof __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates === "boolean") {
322
334
  return __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates;
323
335
  }
@@ -751,13 +751,13 @@ class Client extends Composer {
751
751
  */
752
752
  async connect() {
753
753
  const unlock = await __classPrivateFieldGet(this, _Client_connectMutex, "f").lock();
754
- if (this.connected) {
755
- return;
756
- }
757
- if (__classPrivateFieldGet(this, _Client_lastConnect, "f") != null && Date.now() - __classPrivateFieldGet(this, _Client_lastConnect, "f").getTime() <= 10 * _1_utilities_js_1.second) {
758
- await new Promise((r) => setTimeout(r, 3 * _1_utilities_js_1.second));
759
- }
760
754
  try {
755
+ if (this.connected) {
756
+ return;
757
+ }
758
+ if (__classPrivateFieldGet(this, _Client_lastConnect, "f") != null && Date.now() - __classPrivateFieldGet(this, _Client_lastConnect, "f").getTime() <= 10 * _1_utilities_js_1.second) {
759
+ await new Promise((r) => setTimeout(r, 3 * _1_utilities_js_1.second));
760
+ }
761
761
  await __classPrivateFieldGet(this, _Client_instances, "m", _Client_initStorage).call(this);
762
762
  const [authKey, dc] = await Promise.all([this.storage.getAuthKey(), this.storage.getDc()]);
763
763
  if (authKey != null && dc != null) {
@@ -1 +1 @@
1
- {"version":3,"file":"1_connection_tcp.d.ts","sourceRoot":"","sources":["../../src/connection/1_connection_tcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,aAAc,YAAW,UAAU;;IAU9C,OAAO,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAwB;IAC5D,kBAAkB,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK1C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAQK,IAAI;IA+CJ,IAAI,CAAC,CAAC,EAAE,UAAU;IAgBlB,KAAK,CAAC,CAAC,EAAE,UAAU;IA0BzB,KAAK;CAON"}
1
+ {"version":3,"file":"1_connection_tcp.d.ts","sourceRoot":"","sources":["../../src/connection/1_connection_tcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAM5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,aAAc,YAAW,UAAU;;IAU9C,OAAO,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAwB;IAC5D,kBAAkB,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK1C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAQK,IAAI;IA+CJ,IAAI,CAAC,CAAC,EAAE,UAAU;IAgBlB,KAAK,CAAC,CAAC,EAAE,UAAU;IA4BzB,KAAK;CAON"}
@@ -57,6 +57,7 @@ exports.ConnectionTCP = void 0;
57
57
  */
58
58
  const dntShim = __importStar(require("../_dnt.shims.js"));
59
59
  const _0_deps_js_1 = require("../0_deps.js");
60
+ const _0_errors_js_1 = require("../0_errors.js");
60
61
  const _1_utilities_js_1 = require("../1_utilities.js");
61
62
  const L = (0, _1_utilities_js_1.getLogger)("ConnectionTCP");
62
63
  class ConnectionTCP {
@@ -166,8 +167,11 @@ class ConnectionTCP {
166
167
  }
167
168
  if (!this.connected) {
168
169
  this.stateChangeHandler?.(false);
170
+ throw new _0_errors_js_1.ConnectionError("Connection was closed");
171
+ }
172
+ else {
173
+ throw err;
169
174
  }
170
- throw err;
171
175
  }
172
176
  }
173
177
  }
@@ -186,11 +190,11 @@ class ConnectionTCP {
186
190
  exports.ConnectionTCP = ConnectionTCP;
187
191
  _ConnectionTCP_hostname = new WeakMap(), _ConnectionTCP_port = new WeakMap(), _ConnectionTCP_connection = new WeakMap(), _ConnectionTCP_rMutex = new WeakMap(), _ConnectionTCP_wMutex = new WeakMap(), _ConnectionTCP_buffer = new WeakMap(), _ConnectionTCP_nextResolve = new WeakMap(), _ConnectionTCP_canRead = new WeakMap(), _ConnectionTCP_canWrite = new WeakMap(), _ConnectionTCP_instances = new WeakSet(), _ConnectionTCP_assertConnected = function _ConnectionTCP_assertConnected() {
188
192
  if (!this.connected) {
189
- throw new Error("Connection not open");
193
+ throw new _0_errors_js_1.ConnectionError("Connection not open");
190
194
  }
191
195
  }, _ConnectionTCP_rejectRead = function _ConnectionTCP_rejectRead() {
192
196
  if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null) {
193
- __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(new Error("Connection was closed"));
197
+ __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(new _0_errors_js_1.ConnectionError("Connection was closed"));
194
198
  __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
195
199
  }
196
200
  };
@@ -60,7 +60,7 @@ const _0_deps_js_1 = require("../0_deps.js");
60
60
  const _0_errors_js_1 = require("../0_errors.js");
61
61
  const _1_utilities_js_1 = require("../1_utilities.js");
62
62
  const L = (0, _1_utilities_js_1.getLogger)("ConnectionWebSocket");
63
- const errConnectionNotOpen = new Error("Connection not open");
63
+ const errConnectionNotOpen = new _0_errors_js_1.ConnectionError("Connection not open");
64
64
  class ConnectionWebSocket {
65
65
  constructor(url) {
66
66
  _ConnectionWebSocket_instances.add(this);