aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 18:38:58 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 18:38:58 +0000
commit4ada4ab6551d15432749b4b06d838194297f687d (patch)
treef583b018daae2b566ef39d08c4539693ec60c2d7 /messagebus/src
parent69655b7a638e3588b46cbed18d9a644d8b82d9ed (diff)
Replace the dangerous stealBuffer method with a static one that requires std::move to make destruction more visible.
Diffstat (limited to 'messagebus/src')
-rw-r--r--messagebus/src/vespa/messagebus/network/rpcsendv2.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp b/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp
index 6afa1528092..4c5b93048bf 100644
--- a/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp
+++ b/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp
@@ -4,7 +4,6 @@
#include "rpcnetwork.h"
#include "rpcserviceaddress.h"
#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/tracelevel.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/data/databuffer.h>
@@ -49,7 +48,8 @@ Memory SERVICE_F("service");
}
-bool RPCSendV2::isCompatible(stringref method, stringref request, stringref response)
+bool
+RPCSendV2::isCompatible(stringref method, stringref request, stringref response)
{
return (method == METHOD_NAME) &&
(request == METHOD_PARAMS) &&
@@ -133,7 +133,7 @@ RPCSendV2::encodeRequest(FRT_RPCRequest &req, const Version &version, const Rout
args.AddInt32(toCompress.size());
const auto bufferLength = buf.getDataLen();
assert(bufferLength <= INT32_MAX);
- args.AddData(buf.stealBuffer(), bufferLength);
+ args.AddData(DataBuffer::stealBuffer(std::move(buf)), bufferLength);
}
namespace {
@@ -141,7 +141,7 @@ namespace {
class ParamsV2 : public RPCSend::Params
{
public:
- ParamsV2(const FRT_Values &arg)
+ explicit ParamsV2(const FRT_Values &arg)
: _slime()
{
uint8_t encoding = arg[3]._intval8;
@@ -263,7 +263,7 @@ RPCSendV2::createResponse(FRT_Values & ret, const string & version, Reply & repl
ret.AddInt32(toCompress.size());
const auto bufferLength = buf.getDataLen();
assert(bufferLength <= INT32_MAX);
- ret.AddData(buf.stealBuffer(), bufferLength);
+ ret.AddData(DataBuffer::stealBuffer(std::move(buf)), bufferLength);
}