summaryrefslogtreecommitdiff
path: root/src/mongo/rpc
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-04-02 17:16:03 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-04-03 10:26:36 -0400
commit8804404d94ccada2b1060b13f1ca7b9c24692178 (patch)
treec45462b0148d11b66a1f956f58497204db1385f4 /src/mongo/rpc
parentd47bbc343af0b5bbde7b810f63e6b3404ea9e4d6 (diff)
downloadmongo-8804404d94ccada2b1060b13f1ca7b9c24692178.tar.gz
SERVER-39350 Make `opMsgRequestFromAnyProtocol` return owned request messages
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r--src/mongo/rpc/factory.cpp2
-rw-r--r--src/mongo/rpc/op_msg.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/rpc/factory.cpp b/src/mongo/rpc/factory.cpp
index 64bc5372142..475bcc6191e 100644
--- a/src/mongo/rpc/factory.cpp
+++ b/src/mongo/rpc/factory.cpp
@@ -71,7 +71,7 @@ std::unique_ptr<ReplyInterface> makeReply(const Message* unownedMessage) {
OpMsgRequest opMsgRequestFromAnyProtocol(const Message& unownedMessage) {
switch (unownedMessage.operation()) {
case mongo::dbMsg:
- return OpMsgRequest::parse(unownedMessage);
+ return OpMsgRequest::parseOwned(unownedMessage);
case mongo::dbQuery:
return opMsgRequestFromLegacyRequest(unownedMessage);
default:
diff --git a/src/mongo/rpc/op_msg.h b/src/mongo/rpc/op_msg.h
index 86bfa8d130e..5983ed63226 100644
--- a/src/mongo/rpc/op_msg.h
+++ b/src/mongo/rpc/op_msg.h
@@ -123,6 +123,10 @@ struct OpMsgRequest : public OpMsg {
return OpMsgRequest(OpMsg::parse(message));
}
+ static OpMsgRequest parseOwned(const Message& message) {
+ return OpMsgRequest(OpMsg::parseOwned(message));
+ }
+
static OpMsgRequest fromDBAndBody(StringData db,
BSONObj body,
const BSONObj& extraFields = {}) {