mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 19:28:29 +00:00
stream: move closeRequest to shared functions
This commit is contained in:
parent
a6733ef0cc
commit
0d82c3e524
@ -16,6 +16,10 @@ const serviceHeaders = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function closeRequest(controller) {
|
||||||
|
try { controller.abort() } catch {}
|
||||||
|
}
|
||||||
|
|
||||||
export function closeResponse(res) {
|
export function closeResponse(res) {
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
|
@ -6,7 +6,7 @@ import { create as contentDisposition } from "content-disposition-header";
|
|||||||
import { metadataManager } from "../sub/utils.js";
|
import { metadataManager } from "../sub/utils.js";
|
||||||
import { destroyInternalStream } from "./manage.js";
|
import { destroyInternalStream } from "./manage.js";
|
||||||
import { env, ffmpegArgs, hlsExceptions } from "../config.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) {
|
function toRawHeaders(headers) {
|
||||||
return Object.entries(headers)
|
return Object.entries(headers)
|
||||||
@ -14,10 +14,6 @@ function toRawHeaders(headers) {
|
|||||||
.join('');
|
.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeRequest(controller) {
|
|
||||||
try { controller.abort() } catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function killProcess(p) {
|
function killProcess(p) {
|
||||||
// ask the process to terminate itself gracefully
|
// ask the process to terminate itself gracefully
|
||||||
p?.kill('SIGTERM');
|
p?.kill('SIGTERM');
|
||||||
|
Loading…
Reference in New Issue
Block a user