*Update dist

This commit is contained in:
Derrick Hammer 2023-04-05 18:02:23 -04:00
parent a59de99e56
commit 4541386514
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 11 additions and 2 deletions

2
dist/index.d.ts.map vendored
View File

@ -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;AAQlD,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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,WAAW,IAAI,OAAO,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Y,CAAqC;IAEzD,OAAO,CAAC,SAAS,CAAe;gBAEpB,EAAE,EAAE,MAAM;IAKtB,OAAO,CAAC,gBAAgB,CAAC,CAAa;IAEtC,IAAI,eAAe,IAAI,UAAU,CAEhC;IAED,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC,IAAI,SAAS,IAAI,UAAU,CAE1B;IAEK,KAAK;YASG,SAAS;IAsDvB,EAAE,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EACnD,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,EAClD,OAAO,CAAC,EAAE,GAAG,GACZ,IAAI;IAiBP,GAAG,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EACpD,KAAK,EAAE,CAAC,EACR,EAAE,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,EACnD,OAAO,CAAC,EAAE,GAAG,EACb,IAAI,CAAC,EAAE,OAAO,GACb,IAAI;IASP,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC,GAAG,IAAI,IAAI;IAUX,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;CAInB;AAID,eAAO,MAAM,YAAY,+BAA4C,CAAC"}

11
dist/index.js vendored
View File

@ -7,6 +7,7 @@ import Backoff from "backoff.js";
import { Mutex } from "async-mutex";
// @ts-ignore
import Protomux from "protomux";
import defer from "p-defer";
export class SwarmClient extends Client {
useDefaultSwarm;
id = 0;
@ -132,7 +133,13 @@ export class Socket extends Client {
}
async _initSync() {
const mux = Protomux.from(this);
let updateDone = defer();
const [update] = this.connectModule("syncProtomux", { id: this.id }, async (data) => {
if (data === true) {
updateDone.resolve();
updateDone = defer();
return;
}
await this.syncMutex.acquire();
["remote", "local"].forEach((field) => {
const rField = `_${field}`;
@ -153,14 +160,16 @@ export class Socket extends Client {
}
});
mux._free = mux._free.filter((item) => item !== undefined);
update(true);
this.syncMutex.release();
});
const send = (mux) => {
const send = async (mux) => {
update({
remote: Object.keys(mux._remote),
local: Object.keys(mux._local),
free: mux._free,
});
await updateDone.promise;
};
mux.syncState = send.bind(undefined, mux);
}