aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2021-03-04 16:05:33 +0100
committerVasil Dimov <vd@FreeBSD.org>2021-03-16 13:53:25 +0100
commit9b05c49ade729311a0f4388a109530ff8d0ed1f9 (patch)
treea1c7de169f42543e66144f3c6b9bcb6cae97e72a /src/util
parent1b6c463e033f861561d1a46ccf7eec069bbac09f (diff)
downloadbitcoin-9b05c49ade729311a0f4388a109530ff8d0ed1f9.tar.xz
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`.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sock.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/sock.h b/src/util/sock.h
index 4b0618dcff..d923de531f 100644
--- a/src/util/sock.h
+++ b/src/util/sock.h
@@ -153,7 +153,7 @@ public:
*/
virtual bool IsConnected(std::string& errmsg) const;
-private:
+protected:
/**
* Contained socket. `INVALID_SOCKET` designates the object is empty.
*/