mirror of
https://github.com/monero-project/monero.git
synced 2025-08-17 10:20:48 -04:00
Remove payload copy in all outgoing p2p messages
This commit is contained in:
parent
e45619e61e
commit
679d05567d
21 changed files with 325 additions and 231 deletions
|
@ -46,6 +46,8 @@
|
|||
#include "block_queue.h"
|
||||
#include "common/perf_timer.h"
|
||||
#include "cryptonote_basic/connection_context.h"
|
||||
#include "net/levin_base.h"
|
||||
#include "p2p/net_node_common.h"
|
||||
#include <boost/circular_buffer.hpp>
|
||||
|
||||
PUSH_WARNINGS
|
||||
|
@ -195,10 +197,11 @@ namespace cryptonote
|
|||
bool post_notify(typename t_parameter::request& arg, cryptonote_connection_context& context)
|
||||
{
|
||||
LOG_PRINT_L2("[" << epee::net_utils::print_connection_context_short(context) << "] post " << typeid(t_parameter).name() << " -->");
|
||||
epee::byte_slice blob;
|
||||
epee::serialization::store_t_to_binary(arg, blob, 256 * 1024); // optimize for block responses
|
||||
|
||||
epee::levin::message_writer out{256 * 1024}; // optimize for block responses
|
||||
epee::serialization::store_t_to_binary(arg, out.buffer);
|
||||
//handler_response_blocks_now(blob.size()); // XXX
|
||||
return m_p2p->invoke_notify_to_peer(t_parameter::ID, epee::to_span(blob), context);
|
||||
return m_p2p->invoke_notify_to_peer(t_parameter::ID, std::move(out), context);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue