diff options
author | Lee Clagett <code@leeclagett.com> | 2019-05-11 11:38:35 -0400 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2019-07-16 16:30:35 +0000 |
commit | bdfc63ae4ddc52e2dece2a031a91509418206cb0 (patch) | |
tree | 495b13c21a9be88fd2aab8f4d188f115053d12c5 /contrib/epee/include/net/levin_protocol_handler.h | |
parent | Merge pull request #5827 (diff) | |
download | monero-bdfc63ae4ddc52e2dece2a031a91509418206cb0.tar.xz |
Add ref-counted buffer byte_slice. Currently used for sending TCP data.
Diffstat (limited to 'contrib/epee/include/net/levin_protocol_handler.h')
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/epee/include/net/levin_protocol_handler.h b/contrib/epee/include/net/levin_protocol_handler.h index 791766762..c510cfd79 100644 --- a/contrib/epee/include/net/levin_protocol_handler.h +++ b/contrib/epee/include/net/levin_protocol_handler.h @@ -157,10 +157,9 @@ namespace levin m_current_head.m_return_code = m_config.m_pcommands_handler->invoke(m_current_head.m_command, buff_to_invoke, return_buff, m_conn_context); m_current_head.m_cb = return_buff.size(); m_current_head.m_have_to_return_data = false; - std::string send_buff((const char*)&m_current_head, sizeof(m_current_head)); - send_buff += return_buff; - if(!m_psnd_hndlr->do_send(send_buff.data(), send_buff.size())) + return_buff.insert(0, (const char*)&m_current_head, sizeof(m_current_head)); + if(!m_psnd_hndlr->do_send(byte_slice{std::move(return_buff)})) return false; } |