net: remove CloseSocket()

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.
This commit is contained in:
Vasil Dimov
2021-04-29 17:35:43 +02:00
parent 175fb2670a
commit e8ff3f0c52
3 changed files with 15 additions and 21 deletions

View File

@@ -24,7 +24,7 @@ FuzzedSock::FuzzedSock(FuzzedDataProvider& fuzzed_data_provider)
FuzzedSock::~FuzzedSock()
{
// Sock::~Sock() will be called after FuzzedSock::~FuzzedSock() and it will call
// Sock::Reset() (not FuzzedSock::Reset()!) which will call CloseSocket(m_socket).
// Sock::Reset() (not FuzzedSock::Reset()!) which will call close(m_socket).
// Avoid closing an arbitrary file descriptor (m_socket is just a random very high number which
// theoretically may concide with a real opened file descriptor).
Reset();