diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:43:15 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:43:15 +0200 |
commit | e9527f5eeda2725a30502f34e358bd67a3f35379 (patch) | |
tree | f470aadc04f09335bfcb833d289d1398f55aa0cf /contrib/epee/include/net | |
parent | Merge pull request #5435 (diff) | |
parent | net_helper: avoid unnecessary memcpy (diff) | |
download | monero-e9527f5eeda2725a30502f34e358bd67a3f35379.tar.xz |
Merge pull request #5436
61d63900 net_helper: avoid unnecessary memcpy (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/net')
-rw-r--r-- | contrib/epee/include/net/net_helper.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h index e8fb40a0a..89cef8134 100644 --- a/contrib/epee/include/net/net_helper.h +++ b/contrib/epee/include/net/net_helper.h @@ -428,9 +428,10 @@ namespace net_utils handler_obj hndlr(ec, bytes_transfered); - char local_buff[10000] = {0}; + static const size_t max_size = 16384; + buff.resize(max_size); - async_read(local_buff, sizeof(local_buff), boost::asio::transfer_at_least(1), hndlr); + 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)) @@ -463,7 +464,7 @@ namespace net_utils return false;*/ m_bytes_received += bytes_transfered; - buff.assign(local_buff, bytes_transfered); + buff.resize(bytes_transfered); return true; } |