mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 20:25:12 -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:
parent
fcb5a89d91
commit
5e8209abb3
2 changed files with 4 additions and 1 deletions
|
@ -946,6 +946,7 @@ Deno.test(
|
||||||
signal: ac.signal,
|
signal: ac.signal,
|
||||||
onListen: onListen(listeningPromise),
|
onListen: onListen(listeningPromise),
|
||||||
onError: createOnErrorCb(ac),
|
onError: createOnErrorCb(ac),
|
||||||
|
reusePort: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
await listeningPromise;
|
await listeningPromise;
|
||||||
|
|
|
@ -657,7 +657,7 @@ async function serve(arg1, arg2) {
|
||||||
const listenOpts = {
|
const listenOpts = {
|
||||||
hostname: options.hostname ?? "127.0.0.1",
|
hostname: options.hostname ?? "127.0.0.1",
|
||||||
port: options.port ?? 9000,
|
port: options.port ?? 9000,
|
||||||
reuseport: options.reusePort ?? false,
|
reusePort: options.reusePort ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.cert || options.key) {
|
if (options.cert || options.key) {
|
||||||
|
@ -677,11 +677,13 @@ async function serve(arg1, arg2) {
|
||||||
port: listenOpts.port,
|
port: listenOpts.port,
|
||||||
cert: listenOpts.cert,
|
cert: listenOpts.cert,
|
||||||
key: listenOpts.key,
|
key: listenOpts.key,
|
||||||
|
reusePort: listenOpts.reusePort,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
listener = listen({
|
listener = listen({
|
||||||
hostname: listenOpts.hostname,
|
hostname: listenOpts.hostname,
|
||||||
port: listenOpts.port,
|
port: listenOpts.port,
|
||||||
|
reusePort: listenOpts.reusePort,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue