GeezerVison is showing github.com — chore(shared): simplify port availability comment · pingdotgg/t3code@86394f1
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/Net.ts +1-6Lines changed: 1 addition & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -44,12 +44,6 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()( |
44 | 44 |
|
45 | 45 | /** @public Service construction is part of the canonical Effect module API. */ |
46 | 46 | export const make = () => { |
47 | | - /** |
48 | | - * Returns true when a TCP server can bind to {host, port}. |
49 | | - * `EADDRNOTAVAIL` (no such address, e.g. no `::1`) and `EAFNOSUPPORT` (no |
50 | | - * IPv6 in the kernel, e.g. `ipv6.disable=1`) are treated as available so |
51 | | - * IPv6-absent hosts don't fail availability checks. |
52 | | - */ |
53 | 47 | const canListenOnHost = (port: number, host: string): Effect.Effect<boolean> => |
54 | 48 | Effect.callback<boolean>((resume) => { |
55 | 49 | const server = NodeNet.createServer(); |
@@ -64,6 +58,7 @@ export const make = () => { |
64 | 58 | server.unref(); |
65 | 59 |
|
66 | 60 | server.once("error", (cause) => { |
| 61 | + // Missing IPv6 addresses or kernel support do not mean the port is occupied. |
67 | 62 | if ( |
68 | 63 | isErrnoExceptionWithCode(cause) && |
69 | 64 | (cause.code === "EADDRNOTAVAIL" || cause.code === "EAFNOSUPPORT") |
|