diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2022-06-21 15:23:37 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2022-06-22 09:19:43 +0200 |
commit | a724c39606273dfe4c6f9887ef8b77d0a98f1b34 (patch) | |
tree | 092db93c07cbfce5dd25cc5353a342197390a619 /src/util/sock.h | |
parent | e8ff3f0c52e7512a580bc907dc72e5bb141b4217 (diff) | |
download | bitcoin-a724c39606273dfe4c6f9887ef8b77d0a98f1b34.tar.xz |
net: rename Sock::Reset() to Sock::Close() and make it private
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.
Diffstat (limited to 'src/util/sock.h')
-rw-r--r-- | src/util/sock.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util/sock.h b/src/util/sock.h index 71c6a49321..5ca5f1b91b 100644 --- a/src/util/sock.h +++ b/src/util/sock.h @@ -69,11 +69,6 @@ public: [[nodiscard]] virtual SOCKET Get() const; /** - * Close if non-empty. - */ - virtual void Reset(); - - /** * send(2) wrapper. Equivalent to `send(this->Get(), data, len, flags);`. Code that uses this * wrapper can be unit tested if this method is overridden by a mock Sock implementation. */ @@ -245,6 +240,12 @@ protected: * Contained socket. `INVALID_SOCKET` designates the object is empty. */ SOCKET m_socket; + +private: + /** + * Close `m_socket` if it is not `INVALID_SOCKET`. + */ + void Close(); }; /** Return readable error string for a network error code */ |