aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-10-11 13:03:40 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-10-11 13:03:40 -0500
commit88b80583b8847ac1406711b951852ea042b215e8 (patch)
tree735a37e3e3bcac50e7e2ecae2aca8bb1f65a8bc5 /src/p2p
parentMerge pull request #7976 (diff)
parentQuicker resource cleanup on p2p socks timeout (diff)
downloadmonero-88b80583b8847ac1406711b951852ea042b215e8.tar.xz
Merge pull request #7978
4d224de Quicker resource cleanup on p2p socks timeout (Lee *!* Clagett)
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index 8dd551d1e..36977346d 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -338,6 +338,7 @@ namespace nodetool
}
};
+ net::socks::client::close_on_exit close_client{};
boost::unique_future<client_result> socks_result{};
{
boost::promise<client_result> socks_promise{};
@@ -346,6 +347,7 @@ namespace nodetool
auto client = net::socks::make_connect_client(
boost::asio::ip::tcp::socket{service}, net::socks::version::v4a, notify{std::move(socks_promise)}
);
+ close_client.self = client;
if (!start_socks(std::move(client), proxy, remote))
return boost::none;
}
@@ -367,7 +369,10 @@ namespace nodetool
{
auto result = socks_result.get();
if (!result.first)
+ {
+ close_client.self.reset();
return {std::move(result.second)};
+ }
MERROR("Failed to make socks connection to " << remote.str() << " (via " << proxy << "): " << result.first.message());
}