Change epee binary output from std::stringstream to byte_stream

This commit is contained in:
Lee Clagett 2020-10-13 15:15:07 +00:00
parent b7425c14c8
commit 7414e2bac1
23 changed files with 126 additions and 106 deletions

View file

@ -37,6 +37,7 @@
#include <boost/program_options/variables_map.hpp>
#include <string>
#include "byte_slice.h"
#include "math_helper.h"
#include "storages/levin_abstract_invoke2.h"
#include "warnings.h"
@ -100,7 +101,7 @@ namespace cryptonote
void set_p2p_endpoint(nodetool::i_p2p_endpoint<connection_context>* p2p);
//bool process_handshake_data(const blobdata& data, cryptonote_connection_context& context);
bool process_payload_sync_data(const CORE_SYNC_DATA& hshd, cryptonote_connection_context& context, bool is_inital);
bool get_payload_sync_data(blobdata& data);
bool get_payload_sync_data(epee::byte_slice& data);
bool get_payload_sync_data(CORE_SYNC_DATA& hshd);
bool on_callback(cryptonote_connection_context& context);
t_core& get_core(){return m_core;}
@ -191,10 +192,10 @@ 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() << " -->");
std::string blob;
epee::serialization::store_t_to_binary(arg, blob);
epee::byte_slice blob;
epee::serialization::store_t_to_binary(arg, blob, 256 * 1024); // optimize for block responses
//handler_response_blocks_now(blob.size()); // XXX
return m_p2p->invoke_notify_to_peer(t_parameter::ID, epee::strspan<uint8_t>(blob), context);
return m_p2p->invoke_notify_to_peer(t_parameter::ID, epee::to_span(blob), context);
}
};