@celljs/ta-rooms 4.24.0 → 4.24.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.
Files changed (2) hide show
  1. package/host/index.mjs +9 -3
  2. package/package.json +4 -4
package/host/index.mjs CHANGED
@@ -2616,7 +2616,7 @@ class RoomFiles {
2616
2616
  coming = new Map;
2617
2617
  asks = new Map;
2618
2618
  serving = new Map;
2619
- sending = Promise.resolve();
2619
+ sending = new Map;
2620
2620
  sentChain = Promise.resolve();
2621
2621
  timer;
2622
2622
  constructor(doubles, options = {}) {
@@ -2632,6 +2632,7 @@ class RoomFiles {
2632
2632
  dispose() {
2633
2633
  clearInterval(this.timer);
2634
2634
  this.serving.clear();
2635
+ this.sending.clear();
2635
2636
  }
2636
2637
  root() {
2637
2638
  return join2(this.doubles.host.agentDir, "ta-rooms", "files");
@@ -2833,7 +2834,7 @@ class RoomFiles {
2833
2834
  const token = Symbol(id);
2834
2835
  const serving = `${counted}:${id}`;
2835
2836
  this.serving.set(serving, token);
2836
- this.sending = this.sending.then(async () => {
2837
+ const queued = (this.sending.get(counted) ?? Promise.resolve()).then(async () => {
2837
2838
  const handle = await open(path, "r");
2838
2839
  try {
2839
2840
  for (let part = start;part < parts && this.serving.get(serving) === token; part++) {
@@ -2850,7 +2851,12 @@ class RoomFiles {
2850
2851
  this.serving.delete(serving);
2851
2852
  }
2852
2853
  }
2853
- }).catch((error) => console.error("ta-rooms could not send a file:", error));
2854
+ }).catch((error) => console.error("ta-rooms could not send a file:", error)).finally(() => {
2855
+ if (this.sending.get(counted) === queued) {
2856
+ this.sending.delete(counted);
2857
+ }
2858
+ });
2859
+ this.sending.set(counted, queued);
2854
2860
  }
2855
2861
  async part(event) {
2856
2862
  const { id, part, parts, d } = event.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-rooms",
3
- "version": "4.24.0",
3
+ "version": "4.24.1",
4
4
  "description": "A pi package for Ta: rooms shared with other Ta through the relay, end to end: who asks to join and the owner's answer, your rooms and their members, your Ta friends, and links that invite",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.24.0",
31
- "@celljs/ta-relay": "4.24.0",
32
- "@celljs/ta-web": "4.24.0",
30
+ "@celljs/ta-protocol": "4.24.1",
31
+ "@celljs/ta-relay": "4.24.1",
32
+ "@celljs/ta-web": "4.24.1",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {