diff options
Diffstat (limited to 'contrib/epee/include/net/net_helper.h')
-rw-r--r-- | contrib/epee/include/net/net_helper.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h index a1f44cab0..0a35797fd 100644 --- a/contrib/epee/include/net/net_helper.h +++ b/contrib/epee/include/net/net_helper.h @@ -42,7 +42,6 @@ #include <boost/thread/future.hpp> #include <boost/lambda/bind.hpp> #include <boost/lambda/lambda.hpp> -#include <boost/interprocess/detail/atomic.hpp> #include <boost/system/error_code.hpp> #include <boost/utility/string_ref.hpp> #include <functional> @@ -110,7 +109,7 @@ namespace net_utils m_initialized(true), m_connected(false), m_deadline(m_io_service, std::chrono::steady_clock::time_point::max()), - m_shutdowned(0), + m_shutdowned(false), m_bytes_sent(0), m_bytes_received(0) { @@ -435,7 +434,7 @@ namespace net_utils async_read(&buff[0], max_size, boost::asio::transfer_at_least(1), hndlr); // Block until the asynchronous operation has completed. - while (ec == boost::asio::error::would_block && !boost::interprocess::ipcdetail::atomic_read32(&m_shutdowned)) + while (ec == boost::asio::error::would_block && !m_shutdowned) { m_io_service.reset(); m_io_service.run_one(); @@ -519,7 +518,7 @@ namespace net_utils async_read((char*)buff.data(), buff.size(), boost::asio::transfer_at_least(buff.size()), hndlr); // Block until the asynchronous operation has completed. - while (ec == boost::asio::error::would_block && !boost::interprocess::ipcdetail::atomic_read32(&m_shutdowned)) + while (ec == boost::asio::error::would_block && !m_shutdowned) { m_io_service.run_one(); } @@ -576,7 +575,7 @@ namespace net_utils m_ssl_socket->next_layer().close(ec); if(ec) MDEBUG("Problems at close: " << ec.message()); - boost::interprocess::ipcdetail::atomic_write32(&m_shutdowned, 1); + m_shutdowned = true; m_connected = false; return true; } @@ -685,7 +684,7 @@ namespace net_utils bool m_initialized; bool m_connected; boost::asio::steady_timer m_deadline; - volatile uint32_t m_shutdowned; + std::atomic<bool> m_shutdowned; std::atomic<uint64_t> m_bytes_sent; std::atomic<uint64_t> m_bytes_received; }; |