Example #1
0
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));
}
Example #2
0
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));
}