diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-20 17:27:15 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-20 17:27:15 +0100 |
commit | 969b5a2ae3ac9097e566128b494c6dbc873370c2 (patch) | |
tree | 9afaecb683aa9de55d0786433e621b42f10ecf6e | |
parent | Merge pull request #2601 (diff) | |
download | monero-969b5a2ae3ac9097e566128b494c6dbc873370c2.tar.xz |
net_helper: fix massive slowdown after SSL support
-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); } |