1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

refactor(ext/http): bring back 'reusePort' option for 'Deno.serve()' (#18590)

Closes https://github.com/denoland/deno/issues/18582
This commit is contained in:
Bartek Iwańczuk 2023-04-04 16:17:36 +02:00 committed by GitHub
parent a1764f7690
commit c4628aa809
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -946,6 +946,7 @@ Deno.test(
signal: ac.signal,
onListen: onListen(listeningPromise),
onError: createOnErrorCb(ac),
reusePort: true,
});
await listeningPromise;

View file

@ -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,
});
}