mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01: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:
@@ -13,6 +13,7 @@
|
||||
#include <netaddress.h>
|
||||
#include <serialize.h>
|
||||
#include <util/sock.h>
|
||||
#include <util/threadinterrupt.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -220,7 +221,10 @@ bool ConnectSocketDirectly(const CService &addrConnect, const Sock& sock, int nT
|
||||
*/
|
||||
bool ConnectThroughProxy(const Proxy& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed);
|
||||
|
||||
void InterruptSocks5(bool interrupt);
|
||||
/**
|
||||
* Interrupt SOCKS5 reads or writes.
|
||||
*/
|
||||
extern CThreadInterrupt g_socks5_interrupt;
|
||||
|
||||
/**
|
||||
* Connect to a specified destination service through an already connected
|
||||
|
||||
Reference in New Issue
Block a user