diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-04-04 16:17:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 14:17:36 +0000 |
commit | c4628aa8090f2ec1a5a7616a987c653d0bfd6341 (patch) | |
tree | 82b8b6026c04b5ba1152beb0a22ccd6353f408f8 | |
parent | a1764f7690cfdc3e42724fcad29ef954b7e576a4 (diff) |
refactor(ext/http): bring back 'reusePort' option for 'Deno.serve()' (#18590)
Closes https://github.com/denoland/deno/issues/18582
-rw-r--r-- | cli/tests/unit/serve_test.ts | 1 | ||||
-rw-r--r-- | ext/http/01_http.js | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/cli/tests/unit/serve_test.ts b/cli/tests/unit/serve_test.ts index 00282d521..32d436d04 100644 --- a/cli/tests/unit/serve_test.ts +++ b/cli/tests/unit/serve_test.ts @@ -946,6 +946,7 @@ Deno.test( signal: ac.signal, onListen: onListen(listeningPromise), onError: createOnErrorCb(ac), + reusePort: true, }); await listeningPromise; diff --git a/ext/http/01_http.js b/ext/http/01_http.js index f434acd3c..d0aefc0c3 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -657,7 +657,7 @@ async function serve(arg1, arg2) { const listenOpts = { hostname: options.hostname ?? "127.0.0.1", port: options.port ?? 9000, - reuseport: options.reusePort ?? false, + reusePort: options.reusePort ?? false, }; if (options.cert || options.key) { @@ -677,11 +677,13 @@ async function serve(arg1, arg2) { port: listenOpts.port, cert: listenOpts.cert, key: listenOpts.key, + reusePort: listenOpts.reusePort, }); } else { listener = listen({ hostname: listenOpts.hostname, port: listenOpts.port, + reusePort: listenOpts.reusePort, }); } |