mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
stream/manage: inherit controller from parent istream if it exists (#587)
fixes controller handling for istream HLS playlists
This commit is contained in:
commit
1127e82098
1 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import NodeCache from "node-cache";
|
import NodeCache from "node-cache";
|
||||||
import { randomBytes } from "crypto";
|
import { randomBytes } from "crypto";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
|
import { setMaxListeners } from "node:events";
|
||||||
|
|
||||||
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
|
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
|
||||||
import { env } from "../config.js";
|
import { env } from "../config.js";
|
||||||
|
@ -79,7 +80,13 @@ export function createInternalStream(url, obj = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const streamID = nanoid();
|
const streamID = nanoid();
|
||||||
const controller = new AbortController();
|
let controller = obj.controller;
|
||||||
|
|
||||||
|
if (!controller) {
|
||||||
|
controller = new AbortController();
|
||||||
|
setMaxListeners(Infinity, controller.signal);
|
||||||
|
}
|
||||||
|
|
||||||
internalStreamCache[streamID] = {
|
internalStreamCache[streamID] = {
|
||||||
url,
|
url,
|
||||||
service: obj.service,
|
service: obj.service,
|
||||||
|
|
Loading…
Reference in a new issue