check if socket gets closed before creating sockets pipe. Catch set_option exception

This commit is contained in:
orignal
2026-08-01 09:12:18 -04:00
parent b0b4051595
commit b4666898b5
2 changed files with 22 additions and 3 deletions
+9
View File
@@ -831,6 +831,15 @@ namespace proxy
template<typename Socket>
void SOCKSHandler::SocksUpstreamSuccess(std::shared_ptr<Socket>& upstreamSock)
{
if (!m_sock->is_open ())
{
// check if the socket got closed during upstream handshake
LogPrint(eLogWarning, "SOCKS: Can't link to upstream because socket is closed");
upstreamSock = nullptr;
m_sock = nullptr;
Terminate();
return;
}
LogPrint(eLogInfo, "SOCKS: Upstream success");
boost::asio::const_buffer response(nullptr, 0);
switch (m_socksv)