mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 11:44:14 +01:00
net: convert standalone IsSelectableSocket() to Sock::IsSelectable()
This makes the callers mockable.
This commit is contained in:
@@ -48,6 +48,13 @@ class FuzzedSock : public Sock
|
||||
*/
|
||||
mutable std::optional<uint8_t> m_peek_data;
|
||||
|
||||
/**
|
||||
* Whether to pretend that the socket is select(2)-able. This is randomly set in the
|
||||
* constructor. It should remain constant so that repeated calls to `IsSelectable()`
|
||||
* return the same value.
|
||||
*/
|
||||
const bool m_selectable;
|
||||
|
||||
public:
|
||||
explicit FuzzedSock(FuzzedDataProvider& fuzzed_data_provider);
|
||||
|
||||
@@ -73,6 +80,8 @@ public:
|
||||
|
||||
int GetSockName(sockaddr* name, socklen_t* name_len) const override;
|
||||
|
||||
bool IsSelectable() const override;
|
||||
|
||||
bool Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred = nullptr) const override;
|
||||
|
||||
bool WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per_sock) const override;
|
||||
|
||||
Reference in New Issue
Block a user