node icon indicating copy to clipboard operation
node copied to clipboard

dgram: add dgram send queue info

Open theanarkh opened this issue 1 year ago • 10 comments

Add getSendQueueSize and getSendQueueCount for dgram.

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] documentation is changed or added
  • [x] commit message follows commit guidelines

theanarkh avatar Aug 06 '22 06:08 theanarkh

Review requested:

  • [ ] @nodejs/net

nodejs-github-bot avatar Aug 06 '22 06:08 nodejs-github-bot

Can you add a test where those are non-zero?

Done ! Thanks !

theanarkh avatar Aug 06 '22 07:08 theanarkh

CI: https://ci.nodejs.org/job/node-test-pull-request/45892/

nodejs-github-bot avatar Aug 07 '22 06:08 nodejs-github-bot

@mcollina Hi, can help review this PR again ? Thanks !

theanarkh avatar Aug 07 '22 07:08 theanarkh

It failed on Windows.

node:assert:124
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 10

It seems windows writes the data into os synchronously.

image

On other platforms they will insert the request into write queue first and wait POLLOUT event.

image

I think it's difficult to simulate this, so i just change the code as follows.

assert.ok(client.getSendQueueSize() >= 0);
assert.ok(client.getSendQueueCount() >= 0);

cc @mcollina

theanarkh avatar Aug 07 '22 12:08 theanarkh

You could make an OS conditional switch. At least this oddity would be transparent for the reader.

mcollina avatar Aug 07 '22 14:08 mcollina

Done.

theanarkh avatar Aug 07 '22 14:08 theanarkh

CI: https://ci.nodejs.org/job/node-test-pull-request/45907/

nodejs-github-bot avatar Aug 07 '22 18:08 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/45911/

nodejs-github-bot avatar Aug 08 '22 01:08 nodejs-github-bot

@mcollina Hi , can help review again ? Thanks .

theanarkh avatar Aug 08 '22 12:08 theanarkh

@mcollina Hi , can help review again ?

theanarkh avatar Aug 17 '22 10:08 theanarkh

Landed in 97e8bda5b29561c8c6e30736cd15919403fb7a5b

nodejs-github-bot avatar Aug 17 '22 16:08 nodejs-github-bot

This depends on https://github.com/nodejs/node/pull/44056, which is not landed yet in v16.x

juanarbol avatar Sep 29 '22 22:09 juanarbol