コード例 #1
0
ファイル: alert.cpp プロジェクト: bagdxk/openafs
void Alert_BeginUpdate (LPIDENT lpi, LPSERVER *ppServer)
{
   if (lpi->fIsServer())
      {
      *ppServer = NULL;
      }
   else
      {
      *ppServer = lpi->OpenServer();
      }
}
コード例 #2
0
ファイル: dispatch.cpp プロジェクト: maxendpoint/openafs_cvs
void DispatchNotification_AltThread (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
{
   LPIDENT lpiEvt = pParams->lpi1;

   switch (evt)
      {
      case evtRefreshStatusEnd:
         if (lpiEvt && (lpiEvt->fIsService() || lpiEvt->fIsAggregate() || lpiEvt->fIsFileset()))
            {
            Alert_RemoveSecondary (lpiEvt);
            Alert_Scout_QueueCheckServer (lpiEvt);
            }
         if (lpiEvt && lpiEvt->fIsServer())
            {
            LPSERVER_PREF lpsp;
            if ((lpsp = (LPSERVER_PREF)lpiEvt->GetUserParam()) != NULL)
               {
               LPSERVER lpServer;
               if ((lpServer = lpiEvt->OpenServer()) != NULL)
                  {
                  if (lpsp->fIsMonitored != lpServer->fIsMonitored())
                     {
                     g.sub = Subsets_SetMonitor (g.sub, lpiEvt, lpServer->fIsMonitored());
                     UpdateDisplay_ServerWindow (FALSE, lpiEvt);
                     }
                  lpsp->fIsMonitored = lpServer->fIsMonitored();
                  lpServer->Close();
                  }
               }

            Alert_Scout_ServerStatus (lpiEvt, pParams->status);
            }
         break;

      // When we get a create request, use the object's Get/SetUserParam()
      // methods to attach an allocated structure to the thing--the structure
      // contains the preferences for the server/fileset/etc (for instance,
      // its warning threshholds, any current scout problems, etc).
      // On delete requests, free that structure.
      //
      case evtCreate:
         if (lpiEvt->fIsServer())
            {
            PVOID pPref = Server_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);

            // Should this server be monitored?
            //
            if (!Subsets_fMonitorServer (g.sub, lpiEvt))
               {
               LPSERVER lpServer;
               if ((lpServer = lpiEvt->OpenServer()) != NULL)
                  {
                  lpServer->SetMonitor (FALSE);
                  lpServer->Close();
                  }
               }

            Alert_Scout_SetOutOfDate (lpiEvt);
            }
         else if (lpiEvt->fIsService())
            {
            PVOID pPref = Services_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         else if (lpiEvt->fIsAggregate())
            {
            PVOID pPref = Aggregates_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         else if (lpiEvt->fIsFileset())
            {
            PVOID pPref = Filesets_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         if (!lpiEvt->fIsCell())
            {
            Alert_Scout_QueueCheckServer (lpiEvt);
            }
         break;

      // When we get a create request, use the object's Get/SetUserParam()
      // methods to attach an allocated structure to the thing--the structure
      // contains the preferences for the server/fileset/etc (for instance,
      // its warning threshholds, any current scout problems, etc).
      // On delete requests, free that structure.
      //
      case evtDestroy:
         if (lpiEvt->fIsServer())
            {
            PVOID pPref = lpiEvt->GetUserParam();
            lpiEvt->SetUserParam (0);
            if (pPref)  Delete (pPref);
            }
         else if (lpiEvt->fIsService() || lpiEvt->fIsAggregate() || lpiEvt->fIsFileset())
            {
            Alert_RemoveSecondary (lpiEvt);
            PVOID pPref = lpiEvt->GetUserParam();
            lpiEvt->SetUserParam (0);
            if (pPref)  Delete (pPref);
            }
         break;
      }
}