aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.h
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-04-16 12:45:30 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-04-16 12:45:30 -0500
commit63c7ca07fba2f063c760f786a986fb3e02fb040e (patch)
tree7bd55382b93a902e3fe95704f69e204ea7fac6de /src/cryptonote_protocol/cryptonote_protocol_handler.h
parent2218e23e84a89e9a1e4c0be5d50f891ab836754f (diff)
parent23aae5571b1aa7d28290b194189eac24dd3214c5 (diff)
downloadmonzero-core-63c7ca07fba2f063c760f786a986fb3e02fb040e.tar.gz
monzero-core-63c7ca07fba2f063c760f786a986fb3e02fb040e.tar.xz
monzero-core-63c7ca07fba2f063c760f786a986fb3e02fb040e.zip
Merge pull request #7136
23aae55 Remove payload copy in all outgoing p2p messages (Lee Clagett)
Diffstat (limited to 'src/cryptonote_protocol/cryptonote_protocol_handler.h')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h
index 28530f3e7..80dd2bc39 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h
@@ -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);
}
};