Skip to content

net: track bytesWritten in C++ land - #19551

Closed
addaleax wants to merge 4 commits into
nodejs:masterfrom
addaleax:bytes-written
Closed

net: track bytesWritten in C++ land#19551
addaleax wants to merge 4 commits into
nodejs:masterfrom
addaleax:bytes-written

Conversation

@addaleax

Copy link
Copy Markdown
Member

Move tracking of socket.bytesWritten to C++ land.

This makes it easier to provide this functionality for all
StreamBase instances, and in particular should keep working
when they have been 'consumed' in C++ in some way (e.g. for
the network sockets that are underlying to TLS or HTTP2 streams).

Also, this parallels socket.bytesRead a lot more now.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Mar 23, 2018
@addaleax

Copy link
Copy Markdown
MemberAuthor

Added a regression test for #19562 + a bit more cleanup to make sure req.bytes always refers to the total length of the dispatched data

@addaleax

addaleax commented Mar 24, 2018

Copy link
Copy Markdown
MemberAuthor

@addaleax

Copy link
Copy Markdown
MemberAuthor

/cc @jasnell@apapirovski

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 27, 2018
@addaleax

Copy link
Copy Markdown
MemberAuthor

@addaleaxaddaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 28, 2018
Move tracking of `socket.bytesWritten` to C++ land.
This makes it easier to provide this functionality for all
`StreamBase` instances, and in particular should keep working
when they have been 'consumed' in C++ in some way (e.g. for
the network sockets that are underlying to TLS or HTTP2 streams).
Also, this parallels `socket.bytesRead` a lot more now.
Simply always tell the caller how many bytes were written, rather
than letting them track it.
In the case of writing a string, also keep track of the bytes
written by the earlier `DoTryWrite()`.
Refs: nodejs#19562
@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 29, 2018
@addaleax

Copy link
Copy Markdown
MemberAuthor

@addaleax

Copy link
Copy Markdown
MemberAuthor

Landed in abc8786...b7cfd27

addaleax added a commit that referenced this pull request Mar 30, 2018
Move tracking of `socket.bytesWritten` to C++ land.
This makes it easier to provide this functionality for all
`StreamBase` instances, and in particular should keep working
when they have been 'consumed' in C++ in some way (e.g. for
the network sockets that are underlying to TLS or HTTP2 streams).
Also, this parallels `socket.bytesRead` a lot more now.
PR-URL: #19551
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Mar 30, 2018
Fixes: #19562
PR-URL: #19551
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Mar 30, 2018
Simply always tell the caller how many bytes were written, rather
than letting them track it.
In the case of writing a string, also keep track of the bytes
written by the earlier `DoTryWrite()`.
Refs: #19562
PR-URL: #19551
Reviewed-By: James M Snell <jasnell@gmail.com>
@addaleax
addaleax deleted the bytes-written branch March 30, 2018 12:29
@targos

Copy link
Copy Markdown
Member

Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

@targostargos added backport-requested-v9.x and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Apr 2, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 1, 2018
Move tracking of `socket.bytesWritten` to C++ land.
This makes it easier to provide this functionality for all
`StreamBase` instances, and in particular should keep working
when they have been 'consumed' in C++ in some way (e.g. for
the network sockets that are underlying to TLS or HTTP2 streams).
Also, this parallels `socket.bytesRead` a lot more now.
PR-URL: nodejs#19551
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 1, 2018
Fixes: nodejs#19562
PR-URL: nodejs#19551
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 1, 2018
Simply always tell the caller how many bytes were written, rather
than letting them track it.
In the case of writing a string, also keep track of the bytes
written by the earlier `DoTryWrite()`.
Refs: nodejs#19562
PR-URL: nodejs#19551
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Jun 29, 2018
Fixes: #19562
PR-URL: #19551
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 9, 2018
rvagg pushed a commit that referenced this pull request Aug 16, 2018
Fixes: #19562
PR-URL: #19551
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@addaleax@targos@jasnell@nodejs-github-bot