Seems like we can skip this dance through:
--- a/src/test/fuzz/http_request.cpp
+++ b/src/test/fuzz/http_request.cpp
@@ -78,7 +78,7 @@ void SingleShotParse(const std::string& http_buffer, FuzzedDataProvider& provide
class FuzzClient : public HTTPRemoteClient
{
public:
- FuzzClient() : HTTPRemoteClient{/*id=*/0, /*addr=*/CService(), /*socket=*/CreateSock(0, 0, 0)} {}
+ FuzzClient() : HTTPRemoteClient{/*id=*/0, /*addr=*/CService(), /*socket=*/std::make_unique<ZeroSock>()} {}
void receive(std::string_view s) { MutateRecvBuffer().append(s); }
};
@@ -164,12 +164,6 @@ void CheckSegmentationIndependence(const std::string& input, FuzzedDataProvider&
FakeNodeClock clock{1610000000s};
FakeSteadyClock steady_clock;
- // fuzz.cpp points CreateSock at std::terminate(), and a client needs a socket
- // even though nothing here connects to anything. Keep it deterministic: a
- // FuzzedSock would consume fuzz data and desynchronise the two runs below.
- auto CreateSockOrig{CreateSock};
- CreateSock = [](int, int, int) { return std::make_unique<ZeroSock>(); };
-
// The whole stream arrives in one I/O cycle.
RunResult one_shot;
{
@@ -194,8 +188,6 @@ void CheckSegmentationIndependence(const std::string& input, FuzzedDataProvider&
sliced.remainder = client->GetRecvBuffer();
}
- CreateSock = CreateSockOrig;
-
assert(one_shot.requests == sliced.requests);
assert(one_shot.errored == sliced.errored);
// The whole receive buffer is discarded on a parse error, so how much is