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:
Vasil Dimov
2023-07-13 14:17:30 +02:00
parent 1b19d1117c
commit af0fca530e
4 changed files with 106 additions and 112 deletions

View File

@@ -3260,7 +3260,6 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
// Start threads
//
assert(m_msgproc);
InterruptSocks5(false);
interruptNet.reset();
flagInterruptMsgProc = false;
@@ -3332,7 +3331,7 @@ void CConnman::Interrupt()
condMsgProc.notify_all();
interruptNet();
InterruptSocks5(true);
g_socks5_interrupt();
if (semOutbound) {
for (int i=0; i<m_max_outbound; i++) {