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; }
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; }
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; }
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; }