net: add new method Sock::GetSockName() that wraps getsockname() and use it in GetBindAddress()#25426
Merged
laanwj merged 2 commits intobitcoin:masterfrom Jun 28, 2022
Merged
Conversation
This will help to increase `Sock` usage and make more code mockable.
This avoids the direct call to `getsockname()` and allows mocking.
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
|
Code review ACK a8d6abb |
Closed
laanwj
reviewed
Jun 26, 2022
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Jun 28, 2022
…ps getsockname() and use it in GetBindAddress() a8d6abb net: change GetBindAddress() to take Sock argument (Vasil Dimov) 748dbcd net: add new method Sock::GetSockName() that wraps getsockname() (Vasil Dimov) Pull request description: _This is a piece of bitcoin#21878, chopped off to ease review._ Wrap the syscall `getsockname()` in `Sock::GetSockName()` and change `GetBindAddress()` to take a `Sock` argument so that it can use the wrapper. This further encapsulates syscalls inside the `Sock` class and makes the callers mockable. ACKs for top commit: laanwj: Code review ACK a8d6abb Tree-SHA512: 3a73463258c0057487fb3fd67215816b03a1c5160f45e45930eaeef86bb3611ec385794cdb08339aa074feba8ad67cd2bfd3836f6cbd40834e15d933214a05dc
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.
Wrap the syscall
getsockname()inSock::GetSockName()and changeGetBindAddress()to take aSockargument so that it can use the wrapper.This further encapsulates syscalls inside the
Sockclass and makes the callers mockable.