From af0fca530e4d8311bcb24a14c416e5ad7c30ff78 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 13 Jul 2023 14:17:30 +0200 Subject: 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). --- src/net.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index 994abd986d..6dce17c6d0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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