refactor: make setsockopt() and SetSocketNoDelay() mockable/testable#24357
Merged
laanwj merged 3 commits intoApr 19, 2022
Merged
Conversation
12 tasks
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Member
|
Concept ACK |
jonatack
reviewed
Mar 15, 2022
Member
jonatack
left a comment
There was a problem hiding this comment.
ACK aaf8d7ed1fbcd2f1a90e4f02d50ca7d2864587d0
Some style feedback, feel free to ignore.
aaf8d7e to
3ee641f
Compare
Contributor
Author
|
Invalidates ACK from @jonatack |
Member
|
ACK 3ee641f452dc98644246252613e7590ca5ad88f |
laanwj
reviewed
Apr 14, 2022
This will help to increase `Sock` usage and make more code mockable.
Since the former is mockable, this makes it easier to test higher level code that sets the TCP_NODELAY flag.
3ee641f to
a2c4a7a
Compare
Contributor
Author
|
Invalidates ACK from @jonatack |
Member
|
Code review ACK a2c4a7a |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Apr 19, 2022
…() mockable/testable a2c4a7a net: use Sock::SetSockOpt() instead of standalone SetSocketNoDelay() (Vasil Dimov) d65b6c3 net: use Sock::SetSockOpt() instead of setsockopt() (Vasil Dimov) 184e56d net: add new method Sock::SetSockOpt() that wraps setsockopt() (Vasil Dimov) Pull request description: _This is a piece of bitcoin#21878, chopped off to ease review._ Add a `virtual` (thus mockable) method `Sock::SetSockOpt()` that wraps the system `setsockopt()`. Convert the standalone `SetSocketNoDelay()` function to a `virtual` (thus mockable) method `Sock::SetNoDelay()`. This will help avoid syscalls during testing and to mock them to return whatever is suitable for the tests. ACKs for top commit: laanwj: Code review ACK a2c4a7a jonatack: ACK a2c4a7a change since last review is folding `Sock::SetNoDelay()` into the callers Tree-SHA512: 3e2b016c1e4128317a28c17dc9b30472949e1ac3b071b2697c6d30cbcc830df1ee4392a4e23b2ea1ab4e3fb0f59ef450e2a4f3c1df3d8c803dd081652b6c7387
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a piece of #21878, chopped off to ease review.
Add a
virtual(thus mockable) methodSock::SetSockOpt()that wraps the systemsetsockopt().Convert the standalone
SetSocketNoDelay()function to avirtual(thus mockable) methodSock::SetNoDelay().This will help avoid syscalls during testing and to mock them to return whatever is suitable for the tests.