diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-10-31 20:30:36 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-10-31 20:30:36 +0200 |
commit | 0e15653536c60849997fb4a72f5485b0f8cb4ebf (patch) | |
tree | 3f138eeec12a85bc6bf508cac843d5c7af10e64c | |
parent | Merge pull request #2660 (diff) | |
parent | net_helper: fix massive slowdown after SSL support (diff) | |
download | monero-0e15653536c60849997fb4a72f5485b0f8cb4ebf.tar.xz |
Merge pull request #2687
969b5a2a net_helper: fix massive slowdown after SSL support (moneromooo-monero)
-rw-r--r-- | contrib/epee/include/net/net_helper.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h index c8e4c7818..34d223d17 100644 --- a/contrib/epee/include/net/net_helper.h +++ b/contrib/epee/include/net/net_helper.h @@ -382,7 +382,7 @@ namespace net_utils char local_buff[10000] = {0}; - async_read(local_buff, boost::asio::transfer_at_least(1), hndlr); + async_read(local_buff, sizeof(local_buff), 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)) @@ -463,7 +463,7 @@ namespace net_utils handler_obj hndlr(ec, bytes_transfered); - async_read((char*)buff.data(), boost::asio::transfer_at_least(buff.size()), hndlr); + 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)) @@ -599,12 +599,12 @@ namespace net_utils boost::asio::async_write(m_ssl_socket.next_layer(), boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1); } - void async_read(char* buff, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj& hndlr) + void async_read(char* buff, size_t sz, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj& hndlr) { if(!m_ssl) - boost::asio::async_read(m_ssl_socket.next_layer(), boost::asio::buffer(buff, sizeof(buff)), transfer_at_least, hndlr); + boost::asio::async_read(m_ssl_socket.next_layer(), boost::asio::buffer(buff, sz), transfer_at_least, hndlr); else - boost::asio::async_read(m_ssl_socket, boost::asio::buffer(buff, sizeof(buff)), transfer_at_least, hndlr); + boost::asio::async_read(m_ssl_socket, boost::asio::buffer(buff, sz), transfer_at_least, hndlr); } |