@torrent-tv/proxy 2.107.59 → 2.107.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.107.59",
3
+ "version": "2.107.60",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -1783,19 +1783,32 @@ export class EncodeRuns {
1783
1783
  // disposed. A run that had already finished or failed is not among them,
1784
1784
  // which is what keeps a stop from erasing how it actually ended.
1785
1785
  for (const run of running) {
1786
- // The run resumes itself if it was suspended — a stopped process does not
1787
- // act on SIGTERM until it is continued — records the cause, and answers
1788
- // its own exit. Nothing here has to null a field so that the exit is read
1789
- // correctly, because there is no shared field left to misread.
1790
- run.stop(reason);
1791
1786
  // Nothing is cleared up from here. What this run left open is under its
1792
1787
  // own working name, and the encoding layer removes it when the run's
1793
1788
  // ending reaches it — one place, and it needs neither the stretch nor the
1794
1789
  // init bytes this method used to fetch to judge a file by its contents.
1790
+ this.stopRun(run, reason);
1795
1791
  }
1796
1792
  this.#host.logger.info(`transcode ${session.id} ${running.length} encoder(s) stopped: ${reason}`);
1797
1793
  }
1798
1794
 
1795
+ /**
1796
+ * Stop one run, for a stated reason, and nothing else of its output.
1797
+ *
1798
+ * For a caller that knows WHICH run is wrong: an output may hold a second run
1799
+ * near the viewer that is positioned correctly and must keep producing.
1800
+ *
1801
+ * @param {object} run - A live run of this class's.
1802
+ * @param {string} reason - Named in the log.
1803
+ * @returns {void}
1804
+ */
1805
+ stopRun(run, reason) {
1806
+ // The run resumes itself if it was suspended — a stopped process does not
1807
+ // act on SIGTERM until it is continued — records the cause, and answers
1808
+ // its own exit.
1809
+ run.stop(reason);
1810
+ }
1811
+
1799
1812
  /**
1800
1813
  * What moving the encoder BACKWARDS costs, said out loud when it happens.
1801
1814
  *
@@ -98,7 +98,7 @@ export class OutputTimes {
98
98
  #host;
99
99
 
100
100
  /**
101
- * @param {object} host - `logger`, `runsOf`, `stopEncodeRun`, `planEncodersSoon`, `outputs`, `segmentDurationSec`
101
+ * @param {object} host - `logger`, `runsOf`, `stopRun`, `planEncodersSoon`, `outputs`, `segmentDurationSec`
102
102
  */
103
103
  constructor(host) {
104
104
  this.#host = host;
@@ -454,7 +454,8 @@ export class OutputTimes {
454
454
  // claimed. It converges: once the boundary holds the true time, the next
455
455
  // reading agrees with it and the guard above returns before doing anything.
456
456
  for (const member of this.#host.outputs.familyOf(session)) {
457
- if (member === session || runStartingAt(this.#host.runsOf(member), index) === null) {
457
+ const misplaced = member === session ? null : runStartingAt(this.#host.runsOf(member), index);
458
+ if (misplaced === null) {
458
459
  continue;
459
460
  }
460
461
  this.#host.logger.info(
@@ -474,7 +475,7 @@ export class OutputTimes {
474
475
  // which this function has just written it into and which every session of
475
476
  // the file shares. It used to be passed as an argument from here, so only
476
477
  // a run started by this line ever had it.
477
- this.#host.stopEncodeRun(member, `#${index} really begins ${(trueStart - wasAt).toFixed(3)}s later than the table said`);
478
+ this.#host.stopRun(misplaced, `#${index} really begins ${(trueStart - wasAt).toFixed(3)}s later than the table said`);
478
479
  }
479
480
  this.#host.planEncodersSoon();
480
481
  }
@@ -337,7 +337,7 @@ export function wireOutputs({
337
337
  parts.outputTimes = new OutputTimes({
338
338
  logger,
339
339
  runsOf: (...args) => parts.encodeRuns.runsOf(...args),
340
- stopEncodeRun: (...args) => parts.encodeRuns.stopEncodeRun(...args),
340
+ stopRun: (...args) => parts.encodeRuns.stopRun(...args),
341
341
  planEncodersSoon: (...args) => parts.encodeRuns.planEncodersSoon(...args),
342
342
  get outputs() { return parts.outputs; },
343
343
  get segmentDurationSec() { return parts.segmentDurationSec; },