stream/internal: don't abort immediately after close for generic streams (#584)

* stream: move closeRequest to shared functions

* stream: use closeRequest instead of abort() directly

* stream/internal: don't abort immediately after close for generic streams
This commit is contained in:
jj
2024-06-23 17:37:02 +02:00
committed by GitHub
parent a6733ef0cc
commit 33c3c398fc
4 changed files with 14 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import { nanoid } from "nanoid";
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
import { env } from "../config.js";
import { strict as assert } from "assert";
import { closeRequest } from "./shared.js";
// optional dependency
const freebind = env.freebindCIDR && await import('freebind').catch(() => {});
@@ -109,7 +110,7 @@ export function destroyInternalStream(url) {
const id = url.searchParams.get('id');
if (internalStreamCache[id]) {
internalStreamCache[id].controller.abort();
closeRequest(internalStreamCache[id].controller);
delete internalStreamCache[id];
}
}