void SERVER::SendDeleteNotifications (void) { LPENUM pEnum; for (pEnum = m_lAggregates->FindFirst(); pEnum; pEnum = pEnum->FindNext()) { LPAGGREGATE lpAggregate = (LPAGGREGATE)(pEnum->GetObject()); lpAggregate->SendDeleteNotifications (); } for (pEnum = m_lServices->FindFirst(); pEnum; pEnum = pEnum->FindNext()) { LPSERVICE lpService = (LPSERVICE)(pEnum->GetObject()); lpService->SendDeleteNotifications(); } NOTIFYCALLBACK::SendNotificationToAll (evtDestroy, GetIdentifier()); }
BOOL SERVER::RefreshAggregates (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fAggregatesOutOfDate) { m_fAggregatesOutOfDate = FALSE; if (fIsMonitored()) { if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesBegin, GetIdentifier()); // First thing is to forget about what aggregates we think we have // now. // LPENUM pEnum; for (pEnum = m_lAggregates->FindLast(); pEnum; pEnum = pEnum->FindPrevious()) { LPAGGREGATE lpAggregate = (LPAGGREGATE)(pEnum->GetObject()); lpAggregate->SendDeleteNotifications(); m_lAggregates->Remove (lpAggregate); Delete (lpAggregate); } // Next, the harder part: look through the server to find a list // of aggregates. // PVOID hCell; PVOID hVOS; if ((hVOS = OpenVosObject (&hCell, &status)) == NULL) rc = FALSE; else { WORKERPACKET wpBegin; wpBegin.wpVosPartitionGetBegin.hCell = hCell; wpBegin.wpVosPartitionGetBegin.hServer = hVOS; if (!Worker_DoTask (wtaskVosPartitionGetBegin, &wpBegin, &status)) rc = FALSE; else { for (;;) { WORKERPACKET wpNext; wpNext.wpVosPartitionGetNext.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum; if (!Worker_DoTask (wtaskVosPartitionGetNext, &wpNext, &status)) { if (status == ADMITERATORDONE) status = 0; else rc = FALSE; break; } vos_partitionEntry_p pData = &wpNext.wpVosPartitionGetNext.Data; LPTSTR pszName = AnsiToString (pData->name); LPTSTR pszDevice = AnsiToString (pData->deviceName); LPAGGREGATE lpAggregate = New2 (AGGREGATE,(this, pszName, pszDevice)); lpAggregate->m_as.dwID = lpAggregate->GetID(); FreeString (pszDevice, pData->deviceName); FreeString (pszName, pData->name); lpAggregate->m_wGhost |= GHOST_HAS_SERVER_ENTRY; lpAggregate->m_as.ckStorageTotal = pData->totalSpace; lpAggregate->m_as.ckStorageFree = pData->totalFreeSpace; m_lAggregates->Add (lpAggregate); NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpAggregate->GetIdentifier()); } WORKERPACKET wpDone; wpDone.wpVosPartitionGetDone.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum; Worker_DoTask (wtaskVosPartitionGetDone, &wpDone); } CloseVosObject(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesEnd, GetIdentifier(), ((rc) ? 0 : status)); } } if (pStatus && !rc) *pStatus = status; return TRUE; }