mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
server: ensure sendStream terminates on connection close
This commit is contained in:
@@ -97,7 +97,12 @@ export class HttpResponseImpl implements HttpResponse {
|
||||
stream = await clusterSetup.connectRPCObject(stream);
|
||||
|
||||
for await (const chunk of stream) {
|
||||
this.res.write(chunk);
|
||||
await new Promise<void>((r, f) => this.res.write(chunk, e => {
|
||||
if (e)
|
||||
f(e);
|
||||
else
|
||||
r();
|
||||
}));
|
||||
}
|
||||
this.res.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user