summaryrefslogtreecommitdiff
path: root/src/mongo/rpc/protocol.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2015-07-15 10:48:43 -0400
committerBenety Goh <benety@mongodb.com>2015-07-16 15:33:48 -0400
commit0254cdbc2d5f04188e45fe98dec1ca985e2ecf0c (patch)
tree500e3cc27b48eca9fe8d27ea7f71d6f876916bd0 /src/mongo/rpc/protocol.cpp
parent3730754780a7598d4f76bbdc1664a7cb3175cf10 (diff)
downloadmongo-0254cdbc2d5f04188e45fe98dec1ca985e2ecf0c.tar.gz
SERVER-19307 downconvert find/getMore based on wire protocol version
Diffstat (limited to 'src/mongo/rpc/protocol.cpp')
-rw-r--r--src/mongo/rpc/protocol.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/rpc/protocol.cpp b/src/mongo/rpc/protocol.cpp
index 3bb68f77672..fb4683ee4ca 100644
--- a/src/mongo/rpc/protocol.cpp
+++ b/src/mongo/rpc/protocol.cpp
@@ -127,9 +127,6 @@ StatusWith<ProtocolSet> parseProtocolSetFromIsMasterReply(const BSONObj& isMaste
return minWireExtractStatus;
}
- bool hasWireVersionForOpCommandInMongod = (minWireVersion <= WireVersion::RELEASE_3_1_5) &&
- (maxWireVersion >= WireVersion::RELEASE_3_1_5);
-
bool isMongos = false;
std::string msgField;
@@ -143,10 +140,15 @@ StatusWith<ProtocolSet> parseProtocolSetFromIsMasterReply(const BSONObj& isMaste
isMongos = (msgField == "isdbgrid");
}
- return (!isMongos && hasWireVersionForOpCommandInMongod) ? supports::kAll
- : supports::kOpQueryOnly;
+ return (!isMongos && supportsWireVersionForOpCommandInMongod(minWireVersion, maxWireVersion))
+ ? supports::kAll
+ : supports::kOpQueryOnly;
}
+bool supportsWireVersionForOpCommandInMongod(int minWireVersion, int maxWireVersion) {
+ return (minWireVersion <= WireVersion::RELEASE_3_1_5) &&
+ (maxWireVersion >= WireVersion::RELEASE_3_1_5);
+}
} // namespace rpc
} // namespace mongo