From ebe298921c77f4ae894e164b1e2233947078f18c Mon Sep 17 00:00:00 2001 From: atlowChemi Date: Mon, 10 Jul 2023 00:21:58 +0300 Subject: [PATCH 1/2] dgram: socket add `asyncDispose` --- doc/api/dgram.md | 12 ++++++++++++ lib/dgram.js | 10 +++++++++- test/parallel/test-dgram-async-dispose.mjs | 20 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-dgram-async-dispose.mjs diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 88459727d299dc..aa5030d94bce01 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -372,6 +372,17 @@ added: v0.1.99 Close the underlying socket and stop listening for data on it. If a callback is provided, it is added as a listener for the [`'close'`][] event. +### `socket[Symbol.asyncDispose]()` + + + +> Stability: 1 - Experimental + +Calls [`socket.close()`][] and returns a promise that fulfills when the +socket has closed. + ### `socket.connect(port[, address][, callback])` + +> Stability: 1 - Experimental + +Calls [`server.close()`][] and returns a promise that fulfills when the +server has closed. + ### `server.getConnections(callback)`