diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-04-02 17:16:03 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-04-03 10:26:36 -0400 |
commit | 8804404d94ccada2b1060b13f1ca7b9c24692178 (patch) | |
tree | c45462b0148d11b66a1f956f58497204db1385f4 /src/mongo/rpc | |
parent | d47bbc343af0b5bbde7b810f63e6b3404ea9e4d6 (diff) | |
download | mongo-8804404d94ccada2b1060b13f1ca7b9c24692178.tar.gz |
SERVER-39350 Make `opMsgRequestFromAnyProtocol` return owned request messages
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r-- | src/mongo/rpc/factory.cpp | 2 | ||||
-rw-r--r-- | src/mongo/rpc/op_msg.h | 4 |
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 = {}) { |