aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/zmq_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/zmq_server.cpp')
-rw-r--r--src/rpc/zmq_server.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rpc/zmq_server.cpp b/src/rpc/zmq_server.cpp
index 1ee55673e..91e4751d1 100644
--- a/src/rpc/zmq_server.cpp
+++ b/src/rpc/zmq_server.cpp
@@ -28,10 +28,13 @@
#include "zmq_server.h"
+#include <boost/utility/string_ref.hpp>
#include <chrono>
#include <cstdint>
#include <system_error>
+#include "byte_slice.h"
+
namespace cryptonote
{
@@ -73,10 +76,11 @@ void ZmqServer::serve()
{
const std::string message = MONERO_UNWRAP(net::zmq::receive(socket.get()));
MDEBUG("Received RPC request: \"" << message << "\"");
- const std::string& response = handler.handle(message);
+ epee::byte_slice response = handler.handle(message);
- MONERO_UNWRAP(net::zmq::send(epee::strspan<std::uint8_t>(response), socket.get()));
- MDEBUG("Sent RPC reply: \"" << response << "\"");
+ const boost::string_ref response_view{reinterpret_cast<const char*>(response.data()), response.size()};
+ MDEBUG("Sending RPC reply: \"" << response_view << "\"");
+ MONERO_UNWRAP(net::zmq::send(std::move(response), socket.get()));
}
}
catch (const std::system_error& e)