mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 00:05:13 +02:00
netbase: use reliable send() during SOCKS5 handshake
`send(2)` can be interrupted or for another reason it may not fully complete sending all the bytes. We should be ready to retry the send with the remaining bytes. This is what `Sock::SendComplete()` does, thus use it in `Socks5()`. Since `Sock::SendComplete()` takes a `CThreadInterrupt` argument, change also the recv part of `Socks5()` to use `CThreadInterrupt` instead of a boolean. Easier reviewed with `git show -b` (ignore white-space changes).
This commit is contained in:
@@ -32,7 +32,9 @@ FUZZ_TARGET(socks5, .init = initialize_socks5)
|
||||
ProxyCredentials proxy_credentials;
|
||||
proxy_credentials.username = fuzzed_data_provider.ConsumeRandomLengthString(512);
|
||||
proxy_credentials.password = fuzzed_data_provider.ConsumeRandomLengthString(512);
|
||||
InterruptSocks5(fuzzed_data_provider.ConsumeBool());
|
||||
if (fuzzed_data_provider.ConsumeBool()) {
|
||||
g_socks5_interrupt();
|
||||
}
|
||||
// Set FUZZED_SOCKET_FAKE_LATENCY=1 to exercise recv timeout code paths. This
|
||||
// will slow down fuzzing.
|
||||
g_socks5_recv_timeout = (fuzzed_data_provider.ConsumeBool() && std::getenv("FUZZED_SOCKET_FAKE_LATENCY") != nullptr) ? 1ms : default_socks5_recv_timeout;
|
||||
|
||||
Reference in New Issue
Block a user