예제 #1
0
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;
        }
    }
}
예제 #2
0
파일: dbmessage.cpp 프로젝트: Machyne/mongo
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());
}
예제 #3
0
파일: client.cpp 프로젝트: acmorrow/mongo
void Client::initThread(StringData desc,
                        ServiceContext* service,
                        transport::SessionHandle session) {
    invariant(!haveClient());

    std::string fullDesc;
    if (session) {
        fullDesc = str::stream() << desc << session->id();
    } else {
        fullDesc = desc.toString();
    }

    setThreadName(fullDesc);

    // Create the client obj, attach to thread
    currentClient = service->makeClient(fullDesc, std::move(session));
}
예제 #4
0
파일: client.cpp 프로젝트: Machyne/mongo
void Client::initThread(const char* desc,
                        ServiceContext* service,
                        transport::SessionHandle session) {
    invariant(currentClient.getMake()->get() == nullptr);

    std::string fullDesc;
    if (session) {
        fullDesc = str::stream() << desc << session->id();
    } else {
        fullDesc = desc;
    }

    setThreadName(fullDesc.c_str());

    // Create the client obj, attach to thread
    *currentClient.get() = service->makeClient(fullDesc, std::move(session));
}