mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Merge bitcoin/bitcoin#26312: Remove Sock::Get() and Sock::Sock()
7df4508369test: improve sock_tests/move_assignment (Vasil Dimov)5086a99b84net: remove Sock default constructor, it's not necessary (Vasil Dimov)7829272f78net: remove now unnecessary Sock::Get() (Vasil Dimov)944b21b70anet: don't check if the socket is valid in ConnectSocketDirectly() (Vasil Dimov)aeac68d036net: don't check if the socket is valid in GetBindAddress() (Vasil Dimov)5ac1a51ee5i2p: avoid using Sock::Get() for checking for a valid socket (Vasil Dimov) Pull request description: _This is a piece of #21878, chopped off to ease review._ Peeking at the underlying socket file descriptor of `Sock` and checkig if it is `INVALID_SOCKET` is bad encapsulation and stands in the way of testing/mocking/fuzzing. Instead use an empty `unique_ptr` to denote that there is no valid socket where appropriate or outright remove such checks where they are not necessary. The default constructor `Sock::Sock()` is unnecessary now after recent changes, thus remove it. ACKs for top commit: ajtowns: ACK7df4508369jonatack: ACK7df4508369Tree-SHA512: 9742aeeeabe8690530bf74caa6ba296787028c52f4a3342afd193b05dbbb1f6645935c33ba0a5230199a09af01c666bd3c7fb16b48692a0d185356ea59a8ddbf
This commit is contained in:
@@ -77,9 +77,10 @@ template CNetAddr::SerParams ConsumeDeserializationParams(FuzzedDataProvider&) n
|
||||
template CAddress::SerParams ConsumeDeserializationParams(FuzzedDataProvider&) noexcept;
|
||||
|
||||
FuzzedSock::FuzzedSock(FuzzedDataProvider& fuzzed_data_provider)
|
||||
: m_fuzzed_data_provider{fuzzed_data_provider}, m_selectable{fuzzed_data_provider.ConsumeBool()}
|
||||
: Sock{fuzzed_data_provider.ConsumeIntegralInRange<SOCKET>(INVALID_SOCKET - 1, INVALID_SOCKET)},
|
||||
m_fuzzed_data_provider{fuzzed_data_provider},
|
||||
m_selectable{fuzzed_data_provider.ConsumeBool()}
|
||||
{
|
||||
m_socket = fuzzed_data_provider.ConsumeIntegralInRange<SOCKET>(INVALID_SOCKET - 1, INVALID_SOCKET);
|
||||
}
|
||||
|
||||
FuzzedSock::~FuzzedSock()
|
||||
|
||||
Reference in New Issue
Block a user