aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/message.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-05-01 15:13:58 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-05-01 15:13:58 -0500
commit3e21e591b8201fdb852822b1d30faa1fb97d870a (patch)
tree66f7e7af1eb010d5ed97320916b40abc58a36268 /src/rpc/message.cpp
parent26bfd704595323b4e4930e6b3ab1a303411e1f0e (diff)
parentda9915746219482c25b96406d475c6fde9b02a31 (diff)
downloadmonzero-core-3e21e591b8201fdb852822b1d30faa1fb97d870a.tar.gz
monzero-core-3e21e591b8201fdb852822b1d30faa1fb97d870a.tar.xz
monzero-core-3e21e591b8201fdb852822b1d30faa1fb97d870a.zip
Merge pull request #6350
da99157 Use byte_slice for sending zmq messages - removes data copy within zmq (vtnerd)
Diffstat (limited to 'src/rpc/message.cpp')
-rw-r--r--src/rpc/message.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp
index 5b6a1c05b..0d8983cb1 100644
--- a/src/rpc/message.cpp
+++ b/src/rpc/message.cpp
@@ -149,7 +149,7 @@ cryptonote::rpc::error FullMessage::getError()
return err;
}
-std::string FullMessage::getRequest(const std::string& request, const Message& message, const unsigned id)
+epee::byte_slice FullMessage::getRequest(const std::string& request, const Message& message, const unsigned id)
{
rapidjson::StringBuffer buffer;
{
@@ -172,11 +172,11 @@ std::string FullMessage::getRequest(const std::string& request, const Message& m
if (!dest.IsComplete())
throw std::logic_error{"Invalid JSON tree generated"};
}
- return std::string{buffer.GetString(), buffer.GetSize()};
+ return epee::byte_slice{{buffer.GetString(), buffer.GetSize()}};
}
-std::string FullMessage::getResponse(const Message& message, const rapidjson::Value& id)
+epee::byte_slice FullMessage::getResponse(const Message& message, const rapidjson::Value& id)
{
rapidjson::StringBuffer buffer;
{
@@ -207,17 +207,17 @@ std::string FullMessage::getResponse(const Message& message, const rapidjson::Va
if (!dest.IsComplete())
throw std::logic_error{"Invalid JSON tree generated"};
}
- return std::string{buffer.GetString(), buffer.GetSize()};
+ return epee::byte_slice{{buffer.GetString(), buffer.GetSize()}};
}
// convenience functions for bad input
-std::string BAD_REQUEST(const std::string& request)
+epee::byte_slice BAD_REQUEST(const std::string& request)
{
rapidjson::Value invalid;
return BAD_REQUEST(request, invalid);
}
-std::string BAD_REQUEST(const std::string& request, const rapidjson::Value& id)
+epee::byte_slice BAD_REQUEST(const std::string& request, const rapidjson::Value& id)
{
Message fail;
fail.status = Message::STATUS_BAD_REQUEST;
@@ -225,7 +225,7 @@ std::string BAD_REQUEST(const std::string& request, const rapidjson::Value& id)
return FullMessage::getResponse(fail, id);
}
-std::string BAD_JSON(const std::string& error_details)
+epee::byte_slice BAD_JSON(const std::string& error_details)
{
rapidjson::Value invalid;
Message fail;