From df259005d9576555c39c8e793c65d4d1def54014 Mon Sep 17 00:00:00 2001 From: theanarkh Date: Thu, 25 Aug 2022 00:37:53 +0800 Subject: [PATCH] report: add queue info for udp PR-URL: https://github.com/nodejs/node/pull/44345 Reviewed-By: Richard Lau Reviewed-By: Chengzhong Wu --- src/node_report_utils.cc | 9 ++++++++- test/report/test-report-uv-handles.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index 322bc7d5d8579a..b8f32beb203f6d 100644 --- a/src/node_report_utils.cc +++ b/src/node_report_utils.cc @@ -261,7 +261,14 @@ void WalkHandle(uv_handle_t* h, void* arg) { writer->json_keyvalue("writable", static_cast(uv_is_writable(&handle->stream))); } - + if (h->type == UV_UDP) { + writer->json_keyvalue( + "writeQueueSize", + uv_udp_get_send_queue_size(reinterpret_cast(h))); + writer->json_keyvalue( + "writeQueueCount", + uv_udp_get_send_queue_count(reinterpret_cast(h))); + } writer->json_end(); } diff --git a/test/report/test-report-uv-handles.js b/test/report/test-report-uv-handles.js index daa2cc2c8f5802..eff3cbe841b6f7 100644 --- a/test/report/test-report-uv-handles.js +++ b/test/report/test-report-uv-handles.js @@ -260,6 +260,8 @@ if (process.argv[2] === 'child') { found_udp.push('connected'); } assert(handle.is_referenced); + assert.strictEqual(handle.writeQueueSize, 0); + assert.strictEqual(handle.writeQueueCount, 0); }, 2), };