mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 14:44:59 -04:00
epee: better network buffer data structure
avoids pointless allocs and memcpy
This commit is contained in:
parent
6bc0c7e685
commit
85665003a7
22 changed files with 325 additions and 85 deletions
|
@ -56,22 +56,22 @@ namespace
|
|||
{
|
||||
}
|
||||
|
||||
virtual int invoke(int command, const std::string& in_buff, std::string& buff_out, test_levin_connection_context& context)
|
||||
virtual int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, test_levin_connection_context& context)
|
||||
{
|
||||
m_invoke_counter.inc();
|
||||
boost::unique_lock<boost::mutex> lock(m_mutex);
|
||||
m_last_command = command;
|
||||
m_last_in_buf = in_buff;
|
||||
m_last_in_buf = std::string((const char*)in_buff.data(), in_buff.size());
|
||||
buff_out = m_invoke_out_buf;
|
||||
return m_return_code;
|
||||
}
|
||||
|
||||
virtual int notify(int command, const std::string& in_buff, test_levin_connection_context& context)
|
||||
virtual int notify(int command, const epee::span<const uint8_t> in_buff, test_levin_connection_context& context)
|
||||
{
|
||||
m_notify_counter.inc();
|
||||
boost::unique_lock<boost::mutex> lock(m_mutex);
|
||||
m_last_command = command;
|
||||
m_last_in_buf = in_buff;
|
||||
m_last_in_buf = std::string((const char*)in_buff.data(), in_buff.size());
|
||||
return m_return_code;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue