mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 23:48:55 +00:00
net_helper: avoid unnecessary memcpy
This commit is contained in:
parent
9c77dbf376
commit
61d63900b9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user