Skip to content

Commit

Permalink
report: add queue info for udp
Browse files Browse the repository at this point in the history
PR-URL: #44345
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
theanarkh authored and RafaelGSS committed Sep 5, 2022
1 parent c65d7fb commit df25900
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node_report_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,14 @@ void WalkHandle(uv_handle_t* h, void* arg) {
writer->json_keyvalue("writable",
static_cast<bool>(uv_is_writable(&handle->stream)));
}

if (h->type == UV_UDP) {
writer->json_keyvalue(
"writeQueueSize",
uv_udp_get_send_queue_size(reinterpret_cast<uv_udp_t*>(h)));
writer->json_keyvalue(
"writeQueueCount",
uv_udp_get_send_queue_count(reinterpret_cast<uv_udp_t*>(h)));
}
writer->json_end();
}

Expand Down
2 changes: 2 additions & 0 deletions test/report/test-report-uv-handles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};

Expand Down

0 comments on commit df25900

Please sign in to comment.