Example #1
0
DDWORD bc_ObjectMessageFn(LPBASECLASS pObject, HOBJECT hSender, DDWORD messageID, HMESSAGEREAD hRead)
{
	LPAGGREGATE pAggregate;

	// Call the aggregates.
	pAggregate = pObject->m_pFirstAggregate;
	while(pAggregate)
	{
		pAggregate->m_ObjectMessageFn(pObject, pAggregate, hSender, messageID, hRead);
		pAggregate = pAggregate->m_pNextAggregate;
	}

	return 1;
}
Example #2
0
void FILESET::Invalidate (void)
{
   if (!m_fStatusOutOfDate)
      {
      if (m_wGhost & GHOST_HAS_SERVER_ENTRY)
         m_fStatusOutOfDate = TRUE;

      LPAGGREGATE lpAggregate;
      if ((lpAggregate = m_lpiAggregate->OpenAggregate()) != NULL)
         {
         lpAggregate->InvalidateAllocation();
         lpAggregate->Close();
         }

      NOTIFYCALLBACK::SendNotificationToAll (evtInvalidate, GetIdentifier());
      }
}
Example #3
0
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());
}
Example #4
0
FILESET::FILESET (LPAGGREGATE lpAggregateParent, LPVOLUMEID pvid, LPTSTR pszName)
{
   m_lpiAggregate = lpAggregateParent->GetIdentifier();
   m_lpiServer = lpAggregateParent->m_lpiServer;
   m_lpiCell = lpAggregateParent->m_lpiCell;
   m_lpiThis = NULL;
   m_lpiThisRW = NULL;
   m_lpiThisBK = NULL;
   m_idVolume = *pvid;

   lstrcpy (m_szName, pszName);
   m_wGhost = 0;

   m_fStatusOutOfDate = TRUE;
   memset (&m_fs, 0x00, sizeof(FILESETSTATUS));
   m_fs.id = *pvid;

   lpAggregateParent->InvalidateAllocation();
}
Example #5
0
BOOL FILESET::RefreshStatus (BOOL fNotify, ULONG *pStatus)
{
   BOOL rc = TRUE;
   DWORD status = 0;

   if (m_fStatusOutOfDate && (m_wGhost & GHOST_HAS_SERVER_ENTRY))
      {
      m_fStatusOutOfDate = FALSE;

      if (fNotify)
         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier());

      LPSERVER lpServer;
      if ((lpServer = OpenServer (&status)) == NULL)
         rc = FALSE;
      else
         {
         PVOID hCell;
         PVOID hVOS;
         if ((hVOS = lpServer->OpenVosObject (&hCell, &status)) == NULL)
            rc = FALSE;
         else
            {
            WORKERPACKET wp;
            wp.wpVosVolumeGet.hCell = hCell;
            wp.wpVosVolumeGet.hServer = hVOS;
            wp.wpVosVolumeGet.idPartition = NO_PARTITION;
            wp.wpVosVolumeGet.idVolume = m_idVolume;

            LPAGGREGATE lpAggregate;
            if ((lpAggregate = m_lpiAggregate->OpenAggregate()) != NULL)
               {
               wp.wpVosVolumeGet.idPartition = lpAggregate->GetID();
               lpAggregate->Close();
               }

            if (!Worker_DoTask (wtaskVosVolumeGet, &wp, &status))
               rc = FALSE;
            else
               {
               SetStatusFromVOS (&wp.wpVosVolumeGet.Data);

               if ((lpAggregate = m_lpiAggregate->OpenAggregate()) != NULL)
                  {
                  lpAggregate->InvalidateAllocation();
                  lpAggregate->Close();
                  }
               }

            lpServer->CloseVosObject();
            }

         lpServer->Close();
         }

      if (fNotify)
         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status));
      }

   if (pStatus && !rc)
      *pStatus = status;
   return TRUE;
}
Example #6
0
BOOL Alert_Scout_CheckServer (LPSERVER lpServer)
{
   BOOL rc = TRUE;

   LPSERVER_PREF lpsp;
   if ((lpsp = (LPSERVER_PREF)lpServer->GetUserParam()) != NULL)
      {
      LPOBJECTALERTS lpoa;
      if ((lpoa = Alert_GetObjectAlerts (lpServer->GetIdentifier())) != NULL)
         {
         PostNotification (evtScoutBegin, lpServer->GetIdentifier());

         BOOL fChangedServerAlerts = FALSE;

         DWORD dwTickNextTestWhenStarted = lpoa->dwTickNextTest;

         // First look through the server's aggregates and filesets, to
         // find any which have usages over their warning threshholds.
         //
         HENUM heAggregate;
         for (LPAGGREGATE lpAggregate = lpServer->AggregateFindFirst (&heAggregate); lpAggregate; lpAggregate = lpServer->AggregateFindNext (&heAggregate))
            {
            BOOL fChangedAggregateAlerts = FALSE;
            LPIDENT lpiAggregate = lpAggregate->GetIdentifier();

            LPOBJECTALERTS lpoaAggregate;
            if ((lpoaAggregate = Alert_GetObjectAlerts (lpAggregate->GetIdentifier())) != NULL)
               {
               for (size_t iAlert = 0; iAlert < lpoaAggregate->nAlerts; )
                  {
                  if ( (lpoaAggregate->aAlerts[ iAlert ].alert == alertFULL) ||
                       (lpoaAggregate->aAlerts[ iAlert ].alert == alertOVERALLOC) ||
                       (lpoaAggregate->aAlerts[ iAlert ].alert == alertNO_SVRENT) )
                     {
                     fChangedAggregateAlerts = TRUE;
                     fChangedServerAlerts = TRUE;
                     Alert_Remove (lpAggregate->GetIdentifier(), iAlert);
                     }
                  else
                     ++iAlert;
                  }

               LPAGGREGATE_PREF lpap;
               if ((lpap = (LPAGGREGATE_PREF)lpAggregate->GetUserParam()) != NULL)
                  {
                  short wGhost = lpAggregate->GetGhostStatus();
                  if (lpsp->fWarnAggNoServ && !(wGhost & GHOST_HAS_SERVER_ENTRY))
                     {
                     ALERTINFO ai;
                     ai.alert = alertNO_SVRENT;
                     Alert_AddPrimary (lpAggregate->GetIdentifier(), &ai);
                     fChangedAggregateAlerts = TRUE;
                     fChangedServerAlerts = TRUE;
                     }

                  if (lpsp->fWarnAggAlloc && lpap->fWarnAggAlloc)
                     {
                     AGGREGATESTATUS as;
                     if (lpAggregate->GetStatus (&as, TRUE))
                        {
                        if (as.ckStorageAllocated > as.ckStorageTotal)
                           {
                           ALERTINFO ai;
                           ai.alert = alertOVERALLOC;
                           ai.aiOVERALLOC.ckAllocated = as.ckStorageAllocated;
                           ai.aiOVERALLOC.ckCapacity = as.ckStorageTotal;
                           Alert_AddPrimary (lpAggregate->GetIdentifier(), &ai);
                           fChangedAggregateAlerts = TRUE;
                           fChangedServerAlerts = TRUE;
                           }
                        }
                     }

                  short perWarnAggFull = lpap->perWarnAggFull;
                  if (perWarnAggFull == -1)
                     perWarnAggFull = lpsp->perWarnAggFull;
                  if (perWarnAggFull != 0)
                     {
                     AGGREGATESTATUS as;
                     if (lpAggregate->GetStatus (&as, TRUE))
                        {
                        if (as.ckStorageTotal != 0)
                           {
                           short perNow = (short)( (double)(as.ckStorageTotal - as.ckStorageFree) * 100.0 / (double)(as.ckStorageTotal) );

                           if (perNow > perWarnAggFull)
                              {
                              ALERTINFO ai;
                              ai.alert = alertFULL;
                              ai.aiFULL.perWarning = perWarnAggFull;
                              ai.aiFULL.ckWarning = (ULONG)( (double)perWarnAggFull * (double)(as.ckStorageTotal) / 100.0 );
                              Alert_AddPrimary (lpAggregate->GetIdentifier(), &ai);
                              fChangedAggregateAlerts = TRUE;
                              fChangedServerAlerts = TRUE;
                              }
                           }
                        }
                     }
                  }
               }

            HENUM heFileset;
            for (LPFILESET lpFileset = lpAggregate->FilesetFindFirst (&heFileset); lpFileset; lpFileset = lpAggregate->FilesetFindNext (&heFileset))
               {
               BOOL fChangedFilesetAlerts = FALSE;
               LPIDENT lpiFileset = lpFileset->GetIdentifier();

               LPOBJECTALERTS lpoaFileset;
               if ((lpoaFileset = Alert_GetObjectAlerts (lpFileset->GetIdentifier())) != NULL)
                  {
                  for (size_t iAlert = 0; iAlert < lpoaFileset->nAlerts; )
                     {
                     if ( (lpoaFileset->aAlerts[ iAlert ].alert == alertFULL) ||
                          (lpoaFileset->aAlerts[ iAlert ].alert == alertSTATE_NO_VNODE) ||
                          (lpoaFileset->aAlerts[ iAlert ].alert == alertSTATE_NO_SERVICE) ||
                          (lpoaFileset->aAlerts[ iAlert ].alert == alertSTATE_OFFLINE) ||
                          (lpoaFileset->aAlerts[ iAlert ].alert == alertNO_VLDBENT) ||
                          (lpoaFileset->aAlerts[ iAlert ].alert == alertNO_SVRENT) )
                        {
                        fChangedFilesetAlerts = TRUE;
                        fChangedServerAlerts = TRUE;
                        Alert_Remove (lpFileset->GetIdentifier(), iAlert);
                        }
                     else
                        ++iAlert;
                     }
                  }

               LPFILESET_PREF lpfp;
               if ((lpfp = (LPFILESET_PREF)lpFileset->GetUserParam()) != NULL)
                  {
                  FILESETSTATUS fs;
                  if (lpFileset->GetStatus (&fs, TRUE))
                     {
                     if (fs.State & fsNO_VNODE)
                        {
                        ALERTINFO ai;
                        ai.alert = alertSTATE_NO_VNODE;
                        ai.aiSTATE.State = fs.State;
                        Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                        fChangedFilesetAlerts = TRUE;
                        fChangedServerAlerts = TRUE;
                        }
                     else if (fs.State & fsNO_SERVICE)
                        {
                        ALERTINFO ai;
                        ai.alert = alertSTATE_NO_SERVICE;
                        ai.aiSTATE.State = fs.State;
                        Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                        fChangedFilesetAlerts = TRUE;
                        fChangedServerAlerts = TRUE;
                        }
                     else if (fs.State & fsOFFLINE)
                        {
                        ALERTINFO ai;
                        ai.alert = alertSTATE_OFFLINE;
                        ai.aiSTATE.State = fs.State;
                        Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                        fChangedFilesetAlerts = TRUE;
                        fChangedServerAlerts = TRUE;
                        }

                     short perWarnSetFull = lpfp->perWarnSetFull;
                     if (perWarnSetFull == -1)
                        perWarnSetFull = lpsp->perWarnSetFull;
                     if (perWarnSetFull != 0)
                        {
                        if (fs.Type == ftREADWRITE)
                           {
                           if (fs.ckQuota != 0)
                              {
                              short perNow = (short)( (double)(fs.ckUsed) * 100.0 / (double)(fs.ckQuota) );

                              if (perNow > perWarnSetFull)
                                 {
                                 ALERTINFO ai;
                                 ai.alert = alertFULL;
                                 ai.aiFULL.perWarning = perWarnSetFull;
                                 ai.aiFULL.ckWarning = (ULONG)( (double)perWarnSetFull * (double)(fs.ckQuota) / 100.0 );
                                 Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                                 fChangedFilesetAlerts = TRUE;
                                 fChangedServerAlerts = TRUE;
                                 }
                              }
                           }
                        }
                     }

                  short wGhost = lpFileset->GetGhostStatus();
                  if (lpsp->fWarnSetNoVLDB && !(wGhost & GHOST_HAS_VLDB_ENTRY))
                     {
                     ALERTINFO ai;
                     ai.alert = alertNO_VLDBENT;
                     Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                     fChangedFilesetAlerts = TRUE;
                     fChangedServerAlerts = TRUE;
                     }
                  if (lpsp->fWarnSetNoServ && !(wGhost & GHOST_HAS_SERVER_ENTRY) && !(fs.Type == ftREPLICA))
                     {
                     ALERTINFO ai;
                     ai.alert = alertNO_SVRENT;
                     Alert_AddPrimary (lpFileset->GetIdentifier(), &ai);
                     fChangedFilesetAlerts = TRUE;
                     fChangedServerAlerts = TRUE;
                     }
                  }

               lpFileset->Close();
               if (fChangedFilesetAlerts)
                  {
                  PostNotification (evtAlertsChanged, lpiFileset);
                  }
               }

            lpAggregate->Close();
            if (fChangedAggregateAlerts)
               {
               PostNotification (evtAlertsChanged, lpiAggregate);
               }
            }

         // Next look through the server's servces to find any
         // which have stopped.
         //
         HENUM heService;
         for (LPSERVICE lpService = lpServer->ServiceFindFirst (&heService); lpService; lpService = lpServer->ServiceFindNext (&heService))
            {
            BOOL fChangedServiceAlerts = FALSE;
            LPIDENT lpiService = lpService->GetIdentifier();

            LPOBJECTALERTS lpoaService;
            if ((lpoaService = Alert_GetObjectAlerts (lpService->GetIdentifier())) != NULL)
               {
               for (size_t iAlert = 0; iAlert < lpoaService->nAlerts; )
                  {
                  if (lpoaService->aAlerts[ iAlert ].alert == alertSTOPPED)
                     {
                     fChangedServiceAlerts = TRUE;
                     fChangedServerAlerts = TRUE;
                     Alert_Remove (lpService->GetIdentifier(), iAlert);
                     }
                  else
                     ++iAlert;
                  }

               LPSERVICE_PREF lpcp;
               if ((lpcp = (LPSERVICE_PREF)lpService->GetUserParam()) != NULL)
                  {
                  if (lpcp->fWarnSvcStop && lpsp->fWarnSvcStop)
                     {
                     SERVICESTATUS ss;
                     if (lpService->GetStatus (&ss, TRUE))
                        {
                        if (ss.state != SERVICESTATE_RUNNING)
                           {
                           ALERTINFO ai;
                           ai.alert = alertSTOPPED;
                           memcpy (&ai.aiSTOPPED.stStopped,   &ss.timeLastStop, sizeof(SYSTEMTIME));
                           memcpy (&ai.aiSTOPPED.stLastError, &ss.timeLastFail, sizeof(SYSTEMTIME));
                           ai.aiSTOPPED.errLastError = ss.dwErrLast;
                           Alert_AddPrimary (lpService->GetIdentifier(), &ai);
                           fChangedServiceAlerts = TRUE;
                           fChangedServerAlerts = TRUE;
                           }
                        }
                     }
                  }
               }

            lpService->Close();
            if (fChangedServiceAlerts)
               {
               PostNotification (evtAlertsChanged, lpiService);
               }
            }

         if (rc && (dwTickNextTestWhenStarted == lpoa->dwTickNextTest))
            {
            Alert_Scout_SetUpToDate (lpoa);
            }

         if (fChangedServerAlerts)
            {
            PostNotification (evtAlertsChanged, lpServer->GetIdentifier());
            }

         PostNotification (evtScoutEnd, lpServer->GetIdentifier());
         }
      }

   return rc;
}
Example #7
0
size_t Aggregates_GetAlertCount (LPAGGREGATE lpAggregate)
{
   return Alert_GetCount (lpAggregate->GetIdentifier());
}
Example #8
0
DDWORD bc_EngineMessageFn(LPBASECLASS pObject, DDWORD messageID, void *pData, float fData)
{
	LPAGGREGATE pAggregate;
	ObjectCreateStruct *pStruct;
	GenericProp genProp;

	// Handle ReadProp.
	switch(messageID)
	{
		case MID_PRECREATE:
		{
			// Get the props.
			if( fData == 1.0f || fData == 2.0f )
			{
				pStruct = (ObjectCreateStruct*)pData;

				if( g_pServerDE->GetPropGeneric( "Name", &genProp ) == DE_OK )
				{
					SAFE_STRCPY(pStruct->m_Name, genProp.m_String);
					pStruct->m_Name[MAX_CS_FILENAME_LEN] = '\0';
				}
				if( g_pServerDE->GetPropGeneric( "Pos", &genProp ) == DE_OK )
				{
					VEC_COPY( pStruct->m_Pos, genProp.m_Vec );
				}
				if( g_pServerDE->GetPropGeneric( "Rotation", &genProp ) == DE_OK )
				{
					ROT_COPY( pStruct->m_Rotation, genProp.m_Rotation );
				}
				if( g_pServerDE->GetPropGeneric( "Flags", &genProp ) == DE_OK )
				{
					pStruct->m_Flags = genProp.m_Long;
				}
				if( g_pServerDE->GetPropGeneric( "Visible", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_VISIBLE;
					else
						pStruct->m_Flags &= ~FLAG_VISIBLE;
				}
				if( g_pServerDE->GetPropGeneric( "Shadow", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_SHADOW;
					else
						pStruct->m_Flags &= ~FLAG_SHADOW;
				}
				if( g_pServerDE->GetPropGeneric( "RotateableSprite", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_ROTATEABLESPRITE;
					else
						pStruct->m_Flags &= ~FLAG_ROTATEABLESPRITE;
				}
				if( g_pServerDE->GetPropGeneric( "Chromakey", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_SPRITECHROMAKEY;
					else
						pStruct->m_Flags &= ~FLAG_SPRITECHROMAKEY;
				}
				if( g_pServerDE->GetPropGeneric( "Solid", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_SOLID;
					else
						pStruct->m_Flags &= ~FLAG_SOLID;
				}
				if( g_pServerDE->GetPropGeneric( "Gravity", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_GRAVITY;
					else
						pStruct->m_Flags &= ~FLAG_GRAVITY;
				}
				if( g_pServerDE->GetPropGeneric( "TouchNotify", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_TOUCH_NOTIFY;
					else
						pStruct->m_Flags &= ~FLAG_TOUCH_NOTIFY;
				}
				if( g_pServerDE->GetPropGeneric( "Rayhit", &genProp ) == DE_OK )
				{
					if( genProp.m_Bool )
						pStruct->m_Flags |= FLAG_RAYHIT;
					else
						pStruct->m_Flags &= ~FLAG_RAYHIT;
				}
				if( g_pServerDE->GetPropGeneric( "Filename", &genProp ) == DE_OK )
				{
					SAFE_STRCPY(pStruct->m_Filename, genProp.m_String);
					pStruct->m_Filename[MAX_CS_FILENAME_LEN] = '\0';
				}
				if( g_pServerDE->GetPropGeneric( "Skin", &genProp ) == DE_OK )
				{
					SAFE_STRCPY(pStruct->m_SkinName, genProp.m_String);
					pStruct->m_SkinName[MAX_CS_FILENAME_LEN] = '\0';
				}
				break;
			}
		}
	}

	// Call the aggregates.
	pAggregate = pObject->m_pFirstAggregate;
	while(pAggregate)
	{
		pAggregate->m_EngineMessageFn(pObject, pAggregate, messageID, pData, fData);
		pAggregate = pAggregate->m_pNextAggregate;
	}

	// Default return is 1.
	return 1;
}
Example #9
0
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;
}
Example #10
0
BOOL SERVER::RefreshAll (ULONG *pStatus, double dInit, double dFactor)
{
   BOOL rc = TRUE;
   ULONG status = 0;

   if (m_fAggregatesOutOfDate || m_fServicesOutOfDate)
      {
      if ((++cRefreshAllReq) == 1)
         {
         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllBegin, GetIdentifier(), 0);
         }

      double perAGGREGATES = 65.0; // % of time spent finding aggs & sets
      double perSERVICES   = 25.0; // % of time spent finding services
      double perVLDB       = 10.0; // % of time spent finding VLDB info

      if (cRefreshAllReq >= 2) // being called as part of a cell-wide op?
         {
         perAGGREGATES = 80.0; // % of time spent finding aggs & sets
         perSERVICES   = 20.0; // % of time spent finding services
         perVLDB       = 0.0;  // we won't query VLDB stuff ourself.
         }

      NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier());

      if (!CanTalkToServer (&status))  // Determines fCanGetAggregates, fCanGetServices
         {
         if (m_fMonitor)
            SetMonitor (FALSE);
         rc = FALSE;
         }
      else
         {
         if (!m_fCanGetAggregates)
            {
            FreeAggregates();
            m_fAggregatesOutOfDate = FALSE;
            }
         else
            {
            size_t nAggregates = 0;
            size_t iAggregate = 0;
            HENUM hEnum;
            LPAGGREGATE lpAggregate;
            for (lpAggregate = AggregateFindFirst (&hEnum); lpAggregate; lpAggregate = AggregateFindNext (&hEnum))
               {
               ++nAggregates;
               lpAggregate->Close();
               }

            if (nAggregates)
               {
               for (lpAggregate = AggregateFindFirst (&hEnum); lpAggregate; lpAggregate = AggregateFindNext (&hEnum))
                  {
                  ULONG perComplete = (ULONG)( ((double)perAGGREGATES / 100.0) * ((double)iAggregate * 100.0 / nAggregates) );
                  NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllUpdate, lpAggregate->GetIdentifier(), NULL, NULL, NULL, (ULONG)( 100.0 * dInit + dFactor * (double)perComplete ), 0);

                  lpAggregate->RefreshFilesets (TRUE);
                  lpAggregate->Close();

                  ++iAggregate;
                  }
               }
            }

         if (!m_fCanGetServices)
            {
            FreeServices();
            m_fServicesOutOfDate = FALSE;
            }
         else
            {
            size_t nServices = 0;
            size_t iService = 0;
            HENUM hEnum;
            LPSERVICE lpService;
            for (lpService = ServiceFindFirst (&hEnum); lpService; lpService = ServiceFindNext (&hEnum))
               {
               ++nServices;
               lpService->Close();
               }

            if (nServices)
               {
               for (lpService = ServiceFindFirst (&hEnum); lpService; lpService = ServiceFindNext (&hEnum))
                  {
                  ULONG perComplete = (ULONG)( (double)perAGGREGATES + ((double)perSERVICES / 100.0) * ((double)iService * 100.0 / nServices) );
                  NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllUpdate, lpService->GetIdentifier(), NULL, NULL, NULL, (ULONG)( 100.0 * dInit + dFactor * (double)perComplete ), 0);

                  lpService->RefreshStatus (TRUE);
                  lpService->Close();

                  ++iService;
                  }
               }
            }

         if (cRefreshAllReq == 1) // not being called as part of a cell-wide op?
            {
            LPCELL lpCell;
            if ((lpCell = OpenCell()) != NULL)
               {
               lpCell->RefreshVLDB (GetIdentifier(), TRUE, NULL);
               lpCell->Close();
               }
            }
         }

      NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), m_lastStatus);

      if ((--cRefreshAllReq) == 0)
         {
         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllEnd, GetIdentifier(), NULL, NULL, NULL, 100, m_lastStatus);
         }
      }

   if (rc && m_lastStatus)
      rc = FALSE;
   if (!rc && pStatus)
      *pStatus = status;
   return rc;
}