From 0d82c3e524ea0837bd2e105d41ab48134dafe2d4 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sun, 23 Jun 2024 13:51:47 +0000 Subject: [PATCH] stream: move closeRequest to shared functions --- src/modules/stream/shared.js | 4 ++++ src/modules/stream/types.js | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/stream/shared.js b/src/modules/stream/shared.js index 1e2f2e25..fd7d1569 100644 --- a/src/modules/stream/shared.js +++ b/src/modules/stream/shared.js @@ -16,6 +16,10 @@ const serviceHeaders = { } } +export function closeRequest(controller) { + try { controller.abort() } catch {} +} + export function closeResponse(res) { if (!res.headersSent) { res.sendStatus(500); diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js index 2372d6c1..000b7f7f 100644 --- a/src/modules/stream/types.js +++ b/src/modules/stream/types.js @@ -6,7 +6,7 @@ import { create as contentDisposition } from "content-disposition-header"; import { metadataManager } from "../sub/utils.js"; import { destroyInternalStream } from "./manage.js"; import { env, ffmpegArgs, hlsExceptions } from "../config.js"; -import { getHeaders, closeResponse, pipe } from "./shared.js"; +import { getHeaders, closeRequest, closeResponse, pipe } from "./shared.js"; function toRawHeaders(headers) { return Object.entries(headers) @@ -14,10 +14,6 @@ function toRawHeaders(headers) { .join(''); } -function closeRequest(controller) { - try { controller.abort() } catch {} -} - function killProcess(p) { // ask the process to terminate itself gracefully p?.kill('SIGTERM');