void OpQueryReplyBuilder::send(const transport::SessionHandle& session, int queryResultFlags, const Message& requestMsg, int nReturned, int startingFrom, long long cursorId) { Message response; putInMessage(&response, queryResultFlags, nReturned, startingFrom, cursorId); response.header().setId(nextMessageId()); response.header().setResponseToMsgId(requestMsg.header().getId()); uassertStatusOK(session->sinkMessage(response).wait()); }
void ServiceEntryPointMock::run(transport::SessionHandle session) { Message inMessage; while (true) { { stdx::lock_guard<stdx::mutex> lk(_shutdownLock); if (_inShutdown) break; } // sourceMessage() if (!session->sourceMessage(&inMessage).wait().isOK()) { break; } auto resp = handleRequest(nullptr, inMessage, session->remote()); // sinkMessage() if (!session->sinkMessage(resp.response).wait().isOK()) { break; } } }