diff options
Diffstat (limited to 'src/mongo/db/dbdirectclient.cpp')
-rw-r--r-- | src/mongo/db/dbdirectclient.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp index 60a001f534e..46a7d30b0f9 100644 --- a/src/mongo/db/dbdirectclient.cpp +++ b/src/mongo/db/dbdirectclient.cpp @@ -32,7 +32,6 @@ #include "mongo/db/dbdirectclient.h" -#include "mongo/db/assemble_response.h" #include "mongo/db/client.h" #include "mongo/db/commands.h" #include "mongo/db/curop.h" @@ -40,6 +39,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/wire_version.h" #include "mongo/rpc/get_status_from_command_result.h" +#include "mongo/transport/service_entry_point.h" #include "mongo/util/log.h" namespace mongo { @@ -119,12 +119,19 @@ QueryOptions DBDirectClient::_lookupAvailableOptions() { return QueryOptions(DBClientBase::_lookupAvailableOptions() & ~QueryOption_Exhaust); } +namespace { +DbResponse loopbackBuildResponse(OperationContext* const opCtx, Message& toSend) { + return opCtx->getServiceContext()->getServiceEntryPoint()->handleRequest( + opCtx, toSend, HostAndPort{}); +} +} // namespace + bool DBDirectClient::call(Message& toSend, Message& response, bool assertOk, string* actualServer) { DirectClientScope directClientScope(_opCtx); LastError::get(_opCtx->getClient()).startRequest(); CurOp curOp(_opCtx); - auto dbResponse = assembleResponse(_opCtx, toSend, kHostAndPortForDirectClient); + auto dbResponse = loopbackBuildResponse(_opCtx, toSend); invariant(!dbResponse.response.empty()); response = std::move(dbResponse.response); @@ -136,7 +143,7 @@ void DBDirectClient::say(Message& toSend, bool isRetry, string* actualServer) { LastError::get(_opCtx->getClient()).startRequest(); CurOp curOp(_opCtx); - auto dbResponse = assembleResponse(_opCtx, toSend, kHostAndPortForDirectClient); + auto dbResponse = loopbackBuildResponse(_opCtx, toSend); invariant(dbResponse.response.empty()); } |