summaryrefslogtreecommitdiff
path: root/ext/flash/01_http.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-08-26 05:12:11 +0200
committerGitHub <noreply@github.com>2022-08-26 08:42:11 +0530
commitda10c9c8d1f7bf6ada71bb70f5f331ed830e5b0e (patch)
tree1f8e0456e8461f7c66d444e7f8bebcb914bb34a0 /ext/flash/01_http.js
parent376665d1154501660e7b20f760a0482509cff8b0 (diff)
fix(ext/flash): panic on AddrInUse (#15607)
Diffstat (limited to 'ext/flash/01_http.js')
-rw-r--r--ext/flash/01_http.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/flash/01_http.js b/ext/flash/01_http.js
index 4867da161..fbc24d73d 100644
--- a/ext/flash/01_http.js
+++ b/ext/flash/01_http.js
@@ -28,7 +28,7 @@
const {
Function,
ObjectPrototypeIsPrototypeOf,
- PromiseResolve,
+ PromiseAll,
TypedArrayPrototypeSubarray,
TypeError,
Uint8Array,
@@ -249,7 +249,8 @@
core.opAsync("op_flash_wait_for_listening", serverId).then((port) => {
onListen({ hostname: listenOpts.hostname, port });
- });
+ }).catch(() => {});
+ const finishedPromise = serverPromise.catch(() => {});
const server = {
id: serverId,
@@ -257,7 +258,7 @@
hostname: listenOpts.hostname,
port: listenOpts.port,
closed: false,
- finished: PromiseResolve(serverPromise),
+ finished: finishedPromise,
async close() {
if (server.closed) {
return;
@@ -551,7 +552,10 @@
}, 1000);
}
- return await server.serve().catch(console.error);
+ await PromiseAll([
+ server.serve().catch(console.error),
+ serverPromise,
+ ]);
}
function createRequestBodyStream(serverId, token) {