diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-10-11 13:03:40 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-10-11 13:03:40 -0500 |
commit | 88b80583b8847ac1406711b951852ea042b215e8 (patch) | |
tree | 735a37e3e3bcac50e7e2ecae2aca8bb1f65a8bc5 /src/net | |
parent | Merge pull request #7976 (diff) | |
parent | Quicker resource cleanup on p2p socks timeout (diff) | |
download | monero-88b80583b8847ac1406711b951852ea042b215e8.tar.xz |
Merge pull request #7978
4d224de Quicker resource cleanup on p2p socks timeout (Lee *!* Clagett)
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/socks.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/socks.h b/src/net/socks.h index 739c972ab..506b53195 100644 --- a/src/net/socks.h +++ b/src/net/socks.h @@ -201,6 +201,13 @@ namespace socks std::shared_ptr<client> self_; void operator()(boost::system::error_code error = boost::system::error_code{}); }; + + //! Calls `async_close` on `self` at destruction. NOP if `nullptr`. + struct close_on_exit + { + std::shared_ptr<client> self; + ~close_on_exit() { async_close{std::move(self)}(); } + }; }; template<typename Handler> |