From 21496048ee27de3b5525a09fe4fa19a004a1c71b Mon Sep 17 00:00:00 2001 From: theanarkh Date: Thu, 18 Aug 2022 00:08:58 +0800 Subject: [PATCH] dgram: add dgram send queue info PR-URL: https://github.com/nodejs/node/pull/44149 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen --- doc/api/dgram.md | 17 +++++++++++++ lib/dgram.js | 7 ++++++ src/udp_wrap.cc | 20 +++++++++++++++ src/udp_wrap.h | 3 +++ test/parallel/test-dgram-send-queue-info.js | 27 +++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 test/parallel/test-dgram-send-queue-info.js diff --git a/doc/api/dgram.md b/doc/api/dgram.md index ea26785b570..78930ff45dd 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -454,6 +454,23 @@ added: v8.7.0 This method throws [`ERR_SOCKET_BUFFER_SIZE`][] if called on an unbound socket. +### `socket.getSendQueueSize()` + + + +* Returns: {number} Number of bytes queued for sending. + +### `socket.getSendQueueCount()` + + + +* Returns: {number} Number of send requests currently in the queue awaiting + to be processed. + ### `socket.ref()`