Ejemplo n.º 1
0
DWORD
InitializeIndexingThread(
    VOID
    )
{
    DWORD   dwError = 0;

    dwError = VmDirSrvThrInit(
            &gVdirIndexGlobals.pThrInfo,
            gVdirIndexGlobals.mutex,
            gVdirIndexGlobals.cond,
            TRUE);
    BAIL_ON_VMDIR_ERROR(dwError);

    dwError = VmDirCreateThread(
            &gVdirIndexGlobals.pThrInfo->tid,
            gVdirIndexGlobals.pThrInfo->bJoinThr,
            VmDirIndexingThreadFun,
            gVdirIndexGlobals.pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

cleanup:
    return dwError;

error:
    goto cleanup;
}
Ejemplo n.º 2
0
static
DWORD
VmDirPagedSearchCreateThread(
    PVDIR_PAGED_SEARCH_RECORD pSearchRecord
    )
{
    DWORD dwError = 0;
    PVDIR_THREAD_INFO pThrInfo = NULL;

    dwError = VmDirSrvThrInit(&pThrInfo, NULL, NULL, FALSE);
    BAIL_ON_VMDIR_ERROR(dwError);

    dwError = VmDirCreateThread(
                &pThrInfo->tid,
                pThrInfo->bJoinThr,
                _VmDirPagedSearchWorkerThread,
                pSearchRecord);
    BAIL_ON_VMDIR_ERROR(dwError);

    pSearchRecord->pThreadInfo = pThrInfo;

cleanup:
    return dwError;

error:
    VmDirSrvThrFree(pThrInfo);
    goto cleanup;
}
Ejemplo n.º 3
0
DWORD
VmDirInitRidSynchThr(
    PVDIR_THREAD_INFO* ppThrInfo
    )
{
    DWORD               dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
                pThrInfo,
                NULL,
                NULL,
                TRUE);   // join by main thr

    dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                _VmDirRidSyncThr,
                pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);
    *ppThrInfo = pThrInfo;

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Ejemplo n.º 4
0
DWORD
InitializeDbChkpointThread(
    VOID)
{
    DWORD               dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
            sizeof(*pThrInfo),
            (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
            pThrInfo,
            NULL,
            NULL,
            TRUE);  // join by main thr

    dwError = VmDirCreateThread(
            &pThrInfo->tid,
            FALSE,
            VmDirBdbCheckpointThrFun,
            pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);

cleanup:

    return (int)dwError;  //TODO, should not cast

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Ejemplo n.º 5
0
DWORD
InitializeIndexingThread(
    void)
{
    DWORD       dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
                  sizeof(*pThrInfo),
                  (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
        pThrInfo,
        gVdirAttrIndexGlobals.mutex,       // alternative mutex
        gVdirAttrIndexGlobals.condition,   // alternative cond
        TRUE);                              // join by main thr

    dwError = VmDirCreateThread(
                  &pThrInfo->tid,
                  FALSE,
                  vdirIndexingThrFun,
                  pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Ejemplo n.º 6
0
DWORD
VmDirInitConnAcceptThread(
    void
    )
{
    DWORD               dwError = 0;
    PDWORD              pdwLdapPorts = NULL;
    DWORD               dwLdapPorts = 0;
    PDWORD              pdwLdapsPorts = NULL;
    DWORD               dwLdapsPorts = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;
    PDWORD              pdwPort = NULL;
    DWORD               i = 0;
    BOOLEAN             isIPV6AddressPresent = FALSE;
    BOOLEAN             isIPV4AddressPresent = FALSE;

    dwError = VmDirWhichAddressPresent(&isIPV4AddressPresent, &isIPV6AddressPresent);
    BAIL_ON_VMDIR_ERROR(dwError);
    if (isIPV4AddressPresent)
    {
       gVmdirServerGlobals.isIPV4AddressPresent = TRUE;
    }
    if (isIPV6AddressPresent)
    {
       gVmdirServerGlobals.isIPV6AddressPresent = TRUE;
    }

    VmDirGetLdapListenPorts(&pdwLdapPorts, &dwLdapPorts);
    VmDirGetLdapsListenPorts(&pdwLdapsPorts, &dwLdapsPorts);

    for (i = 0; i < dwLdapPorts; i++)
    {
        dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID*)&pThrInfo);
        BAIL_ON_VMDIR_ERROR(dwError);

        dwError = VmDirAllocateMemory(
                sizeof(DWORD),
                (PVOID)&pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        *pdwPort = pdwLdapPorts[i];

        VmDirSrvThrInit(
                pThrInfo,
                gVmdirGlobals.replCycleDoneMutex,     // alternative mutex
                gVmdirGlobals.replCycleDoneCondition, // alternative cond
                FALSE);  // join by main thr

        dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                vmdirConnAcceptThrFunc,
                (PVOID)pdwPort);  // New thread owns pdwPort
        BAIL_ON_VMDIR_ERROR(dwError);

        VmDirSrvThrAdd(pThrInfo);
        pThrInfo = NULL;
        pdwPort = NULL;
    }

    for (i = 0; gVmdirOpensslGlobals.bSSLInitialized && i < dwLdapsPorts; i++)
    {
        dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID*)&pThrInfo);
        BAIL_ON_VMDIR_ERROR(dwError);

        dwError = VmDirAllocateMemory(
                sizeof(DWORD),
                (PVOID)&pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        *pdwPort = pdwLdapsPorts[i];

        VmDirSrvThrInit(
                pThrInfo,
                gVmdirGlobals.replCycleDoneMutex,     // alternative mutex
                gVmdirGlobals.replCycleDoneCondition, // alternative cond
                FALSE);  // join by main thr

        dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                vmdirSSLConnAcceptThrFunc,
                (PVOID)pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        VmDirSrvThrAdd(pThrInfo);
        pThrInfo = NULL;
        pdwPort = NULL;
    }

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    VMDIR_SAFE_FREE_MEMORY(pdwPort);

    goto cleanup;
}