summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2021-12-14 23:27:04 +0100
committerGitHub <noreply@github.com>2021-12-14 23:27:04 +0100
commit4d176b7b7c11aabc584bee45423f108ea47faefe (patch)
treeaad53141bf673768848b3905ca3d22f2255a74bb /cli
parent2c20e621aadb57bfe1f2b4a234c78298107ba672 (diff)
fix(ext/net): make unix and tcp identical on close (#13075)
std/http/server knows how to handle "Listener has been closed" exceptions but not "operation canceled" errors. Make "unix" listen sockets throw the same exception as "tcp" listen sockets when the socket is closed and has a pending accept operation. There is still a discrepancy when multiple accept requests are posted but that's probably a less visible issue and something for another day. Fixes #13033
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/net_test.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts
index 7efc7e689..578820dda 100644
--- a/cli/tests/unit/net_test.ts
+++ b/cli/tests/unit/net_test.ts
@@ -147,7 +147,8 @@ Deno.test(
listener.close();
await assertRejects(
() => p,
- Deno.errors.Interrupted,
+ Deno.errors.BadResource,
+ "Listener has been closed",
);
},
);
@@ -185,7 +186,7 @@ Deno.test(
const listener = Deno.listen({ transport: "unix", path: filePath });
let acceptErrCount = 0;
const checkErr = (e: Error) => {
- if (e instanceof Deno.errors.Interrupted) { // "operation canceled"
+ if (e.message === "Listener has been closed") {
assertEquals(acceptErrCount, 1);
} else if (e instanceof Deno.errors.Busy) { // "Listener already in use"
acceptErrCount++;