fuzz: implement unimplemented FuzzedSock methods

We want `Get()` to always return the same value, otherwise it will look
like the `FuzzedSock` implementation itself is broken. So assign
`m_socket` a random number in the `FuzzedSock` constructor.

There is nothing to fuzz about the `Get()` and `Release()` methods, so
use the ones from the base class `Sock`.

`Reset()` is just setting our socket to `INVALID_SOCKET`. We don't want
to use the base `Reset()` because it will close `m_socket` and given
that our `m_socket` is just a random number it may end up closing a real
opened file descriptor if it coincides with our random `m_socket`.
This commit is contained in:
Vasil Dimov
2021-03-04 16:05:33 +01:00
parent 1b6c463e03
commit 9b05c49ade
2 changed files with 17 additions and 15 deletions

View File

@@ -153,7 +153,7 @@ public:
*/
virtual bool IsConnected(std::string& errmsg) const;
private:
protected:
/**
* Contained socket. `INVALID_SOCKET` designates the object is empty.
*/