Skip to content

Conversation

addaleax
Copy link
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-bot nodejs-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
Member Author

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
Copy link
Member Author

addaleax commented Mar 24, 2018

@addaleax
Copy link
Member Author

/cc @jasnell @apapirovski

@addaleax addaleax 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
Member Author

Re-building Linux CI: https://ci.nodejs.org/job/node-test-commit-linux/17383/

@addaleax addaleax 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
@addaleax addaleax 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
Member Author

@addaleax
Copy link
Member Author

Landed in abc8786...b7cfd27

@addaleax addaleax closed this Mar 30, 2018
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 <[email protected]>
addaleax added a commit that referenced this pull request Mar 30, 2018
Fixes: #19562

PR-URL: #19551
Reviewed-By: James M Snell <[email protected]>
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 <[email protected]>
@addaleax addaleax deleted the bytes-written branch March 30, 2018 12:29
@targos
Copy link
Member

targos commented Apr 2, 2018

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.

@targos targos 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 <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 1, 2018
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 <[email protected]>
addaleax added a commit that referenced this pull request Jun 29, 2018
Fixes: #19562

PR-URL: #19551
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jul 9, 2018
rvagg pushed a commit that referenced this pull request Aug 16, 2018
Sign up for free to 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 / src Issues 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