summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorGianluca Oldani <oldanigianluca@gmail.com>2022-10-24 11:05:07 +0200
committerGitHub <noreply@github.com>2022-10-24 09:05:07 +0000
commit873a5ce2eddb65cdfea7fc8bbcae3e8dfef5dfb9 (patch)
treec02d782463ae2d8c412118aee35170be6cca7238 /cli/dts/lib.deno.unstable.d.ts
parent38213f1142200e9184d1c5ae1e25ff781248362a (diff)
feat(ext/net): add reuseAddress option for UDP (#13849)
This commit adds a `reuseAddress` option for UDP sockets. When this option is enabled, one can listen on an address even though it is already being listened on from a different process or thread. The new socket will steal the address from the existing socket. On Windows and Linux this uses the `SO_REUSEADDR` option, while on other Unixes this is done with `SO_REUSEPORT`. This behavior aligns with what libuv does. TCP sockets still unconditionally set the `SO_REUSEADDR` flag - this behavior matches Node.js and Go. This PR does not change this behaviour. Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 72f5fc058..85b5911f8 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -1073,6 +1073,17 @@ declare namespace Deno {
/** **UNSTABLE**: New API, yet to be vetted.
*
+ * @category Network
+ */
+ export interface UdpListenOptions extends ListenOptions {
+ /** When `true` the specified address will be reused, even if another
+ * process has already bound a socket on it. This effectively steals the
+ * socket from the listener. Defaults to `false`. */
+ reuseAddress?: boolean;
+ }
+
+ /** **UNSTABLE**: New API, yet to be vetted.
+ *
* Listen announces on the local transport address.
*
* ```ts
@@ -1110,7 +1121,7 @@ declare namespace Deno {
* @category Network
*/
export function listenDatagram(
- options: ListenOptions & { transport: "udp" },
+ options: UdpListenOptions & { transport: "udp" },
): DatagramConn;
/** **UNSTABLE**: New API, yet to be vetted.