diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-05-19 17:06:56 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-06-07 13:28:51 -0400 |
commit | 107327303755a830236bfef5827b543d88223b89 (patch) | |
tree | 25a9c9586fbcf1ba17651fe00abbd4a6bfebd929 /src/mongo/rpc/protocol.cpp | |
parent | b89c05e65c3168cef9c813f3feca2b1a63621ca2 (diff) | |
download | mongo-107327303755a830236bfef5827b543d88223b89.tar.gz |
SERVER-29264 Kill off rpc::RequestInterface
Diffstat (limited to 'src/mongo/rpc/protocol.cpp')
-rw-r--r-- | src/mongo/rpc/protocol.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/rpc/protocol.cpp b/src/mongo/rpc/protocol.cpp index 02d54c5db55..604dc708b52 100644 --- a/src/mongo/rpc/protocol.cpp +++ b/src/mongo/rpc/protocol.cpp @@ -69,6 +69,21 @@ constexpr ProtocolSetAndName protocolSetNames[] = { } // namespace +Protocol protocolForMessage(const Message& message) { + switch (message.operation()) { + case mongo::dbMsg: + return Protocol::kOpMsg; + case mongo::dbQuery: + return Protocol::kOpQuery; + case mongo::dbCommand: + return Protocol::kOpCommandV1; + default: + uasserted(ErrorCodes::UnsupportedFormat, + str::stream() << "Received a reply message with unexpected opcode: " + << message.operation()); + } +} + StatusWith<Protocol> negotiate(ProtocolSet fst, ProtocolSet snd) { using std::begin; using std::end; |