-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Remove Sock::Release() and CloseSocket() #25428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Sock::Release() and CloseSocket() #25428
Conversation
Do the closing in `Sock::Reset()` and remove the standalone `CloseSocket()`. This reduces the exposure of low-level sockets (i.e. integer file descriptors) outside of the `Sock` class.
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. |
|
Concept ACK! Nice cleanup now! |
Outside of `Sock`, `Sock::Reset()` was used in just one place (in `i2p.cpp`) which can use the assignment operator instead. This simplifies the public `Sock` API by having one method less.
e0537da
to
a724c39
Compare
|
Code review ACK a724c39 |
This is a piece of #21878, chopped off to ease review.
Sock::Release()
is unused, thus remove itCloseSocket()
is only called fromSock::Reset()
, so move the body ofCloseSocket()
insideSock::Reset()
and removeCloseSocket()
- this helps to hide low level file descriptor sockets inside theSock
class.Sock::Reset()
toSock::Close()
and make itprivate
- to be used only in the destructor and in theSock
assignment operator. This simplifies the public API by removing one method from it.