diff options
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r-- | src/mongo/rpc/factory.cpp | 6 | ||||
-rw-r--r-- | src/mongo/rpc/factory.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/rpc/factory.cpp b/src/mongo/rpc/factory.cpp index ae16d16c62e..29a0a03c6fa 100644 --- a/src/mongo/rpc/factory.cpp +++ b/src/mongo/rpc/factory.cpp @@ -49,7 +49,11 @@ namespace rpc { std::unique_ptr<RequestBuilderInterface> makeRequestBuilder(ProtocolSet clientProtos, ProtocolSet serverProtos) { - switch (uassertStatusOK(negotiate(clientProtos, serverProtos))) { + return makeRequestBuilder(uassertStatusOK(negotiate(clientProtos, serverProtos))); +} + +std::unique_ptr<RequestBuilderInterface> makeRequestBuilder(Protocol proto) { + switch (proto) { case Protocol::kOpQuery: return stdx::make_unique<LegacyRequestBuilder>(); case Protocol::kOpCommandV1: diff --git a/src/mongo/rpc/factory.h b/src/mongo/rpc/factory.h index 2776ffacc47..f2d4e2fd3cb 100644 --- a/src/mongo/rpc/factory.h +++ b/src/mongo/rpc/factory.h @@ -52,6 +52,8 @@ class RequestInterface; std::unique_ptr<RequestBuilderInterface> makeRequestBuilder(ProtocolSet clientProtos, ProtocolSet serverProtos); +std::unique_ptr<RequestBuilderInterface> makeRequestBuilder(Protocol proto); + /** * Returns the appropriate concrete Reply according to the contents of the message. * Throws if one cannot be chosen. |