From caec48d0a63261398860d25a1c47462e5b2e64fb Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 6 Apr 2023 14:36:16 -0400 Subject: [PATCH] *Update dist --- dist/index.d.ts.map | 2 +- dist/index.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 3db9341..24173d1 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAU,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AAI5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AASlD,qBAAa,WAAY,SAAQ,MAAM;IACrC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,EAAE,CAAa;IACvB,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,eAAe,CAAM;IAE7B,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,mBAAmB,CAAC,CAG1B;IAEF,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,QAAQ,CAAkD;IAElE,IAAI,GAAG;;MAON;gBAEW,aAAa,UAAO,EAAE,aAAa,UAAQ;IAcvD,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAEY,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB5D,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAMd,OAAO;IA2BR,QAAQ,CAAC,MAAM,EAAE,MA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file diff --git a/dist/index.js b/dist/index.js index 285e466..e75a188 100644 --- a/dist/index.js +++ b/dist/index.js @@ -137,12 +137,13 @@ export class Socket extends Client { async _initSync() { this.userData = null; const mux = Protomux.from(this); - let updateDone = defer(); + let updateSent = defer(); + let updateReceived = defer(); const setup = defer(); const [update] = this.connectModule("syncProtomux", { id: this.id }, async (data) => { if (data === true) { - updateDone.resolve(); - updateDone = defer(); + updateSent.resolve(); + updateSent = defer(); return; } await this.syncMutex.acquire(); @@ -165,9 +166,9 @@ export class Socket extends Client { } }); mux._free = mux._free.filter((item) => item !== undefined); - update(true); this.syncMutex.release(); setup.resolve(); + updateReceived.resolve(); }); const send = async (mux) => { update({ @@ -175,7 +176,9 @@ export class Socket extends Client { local: Object.keys(mux._local), free: mux._free, }); - await updateDone.promise; + updateReceived = defer(); + await updateSent.promise; + await updateReceived.promise; }; mux.syncState = send.bind(undefined, mux); await setup.promise;