summaryrefslogtreecommitdiff
path: root/src/mongo/rpc/protocol.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-05-19 17:06:56 -0400
committerMathias Stearn <mathias@10gen.com>2017-06-07 13:28:51 -0400
commit107327303755a830236bfef5827b543d88223b89 (patch)
tree25a9c9586fbcf1ba17651fe00abbd4a6bfebd929 /src/mongo/rpc/protocol.cpp
parentb89c05e65c3168cef9c813f3feca2b1a63621ca2 (diff)
downloadmongo-107327303755a830236bfef5827b543d88223b89.tar.gz
SERVER-29264 Kill off rpc::RequestInterface
Diffstat (limited to 'src/mongo/rpc/protocol.cpp')
-rw-r--r--src/mongo/rpc/protocol.cpp15
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;