mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
Merge pull request #2687
969b5a2a
net_helper: fix massive slowdown after SSL support (moneromooo-monero)
This commit is contained in:
commit
0e15653536
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user