From bdfc63ae4ddc52e2dece2a031a91509418206cb0 Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Sat, 11 May 2019 11:38:35 -0400 Subject: Add ref-counted buffer byte_slice. Currently used for sending TCP data. --- contrib/epee/include/net/levin_protocol_handler.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'contrib/epee/include/net/levin_protocol_handler.h') 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; } -- cgit v1.2.3