(file) Return to CIMServer.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Server

Diff for /pegasus/src/Pegasus/Server/CIMServer.cpp between version 1.190.2.7 and 1.190.2.9

version 1.190.2.7, 2006/10/23 16:51:25 version 1.190.2.9, 2006/10/27 13:03:17
Line 102 
Line 102 
 #include <Pegasus/ControlProviders/InteropProvider/InteropProvider.h> #include <Pegasus/ControlProviders/InteropProvider/InteropProvider.h>
 #endif #endif
  
   #ifdef PEGASUS_SLP_REG_TIMEOUT
   #include <slp/slp_client/src/cmd-utils/slp_client/lslp-linux.h>
   #include <slp/slp_client/src/cmd-utils/slp_client/lslp.h>
   #include <slp/slp_client/src/cmd-utils/slp_client/lslp-common-defs.h>
   #include <slp/slp_client/src/cmd-utils/slp_client/slp_client.h>
   #endif
   
 // l10n // l10n
 #include <Pegasus/Common/MessageLoader.h> #include <Pegasus/Common/MessageLoader.h>
  
Line 113 
Line 120 
 # define SLP_PORT 427 # define SLP_PORT 427
 # define LOCALHOST_IP "127.0.0.1" # define LOCALHOST_IP "127.0.0.1"
 #endif #endif
   
 static CIMServer *_cimserver = NULL; static CIMServer *_cimserver = NULL;
  
 // Need a static method to act as a callback for the control provider. // Need a static method to act as a callback for the control provider.
Line 138 
Line 146 
 // Signal handler for shutdown signals, currently SIGHUP and SIGTERM // Signal handler for shutdown signals, currently SIGHUP and SIGTERM
 // //
 Boolean handleShutdownSignal = false; Boolean handleShutdownSignal = false;
 #ifdef PEGASUS_SLP_REG_TIMEOUT  
 // Signal to shutdown the SLP advertising thread  
    Boolean handleCloseSLPThread = false;  
 #endif  
 void shutdownSignalHandler(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig) void shutdownSignalHandler(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig)
 { {
     PEG_METHOD_ENTER(TRC_SERVER, "shutdownSignalHandler");     PEG_METHOD_ENTER(TRC_SERVER, "shutdownSignalHandler");
Line 156 
Line 160 
 { {
     PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::shutdownSignal()");     PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::shutdownSignal()");
     handleShutdownSignal = true;     handleShutdownSignal = true;
 #ifdef PEGASUS_SLP_REG_TIMEOUT  
     handleCloseSLPThread = true;  
 #endif  
     _cimserver->tickle_monitor();     _cimserver->tickle_monitor();
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
Line 170 
Line 171 
     PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::CIMServer()");     PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::CIMServer()");
     _init();     _init();
     _cimserver = this;     _cimserver = this;
 #ifdef PEGASUS_SLP_REG_TIMEOUT  
     SLPThread = NULL;  
 #endif  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
  
Line 451 
Line 449 
 CIMServer::~CIMServer () CIMServer::~CIMServer ()
 { {
     PEG_METHOD_ENTER (TRC_SERVER, "CIMServer::~CIMServer()");     PEG_METHOD_ENTER (TRC_SERVER, "CIMServer::~CIMServer()");
 #ifdef PEGASUS_SLP_REG_TIMEOUT  
     handleCloseSLPThread = true;  
 #endif  
  
     // Wait until the Shutdown provider request has cleared through the     // Wait until the Shutdown provider request has cleared through the
     // system.     // system.
Line 606 
Line 601 
     // Note: Trace code in this method will be invoked frequently.     // Note: Trace code in this method will be invoked frequently.
     if(!_dieNow)     if(!_dieNow)
     {     {
 #ifdef PEGASUS_ENABLE_SLP  
     // Note - this func prevents multiple starting of slp provider  
     startSLPProvider();  
 #endif  
   
     _monitor->run(500000);  
   
     static struct timeval lastIdleCleanupTime = {0, 0};  
     struct timeval now;     struct timeval now;
     Time::gettimeofday(&now);     Time::gettimeofday(&now);
   #ifdef PEGASUS_ENABLE_SLP
 #ifdef PEGASUS_SLP_REG_TIMEOUT #ifdef PEGASUS_SLP_REG_TIMEOUT
     static struct timeval lastReregistrationTime = now;          static struct timeval lastReregistrationTime = {0,0};
     // units of PEGASUS_SLP_REG_TIMEOUT is minutes. Multiplying PEGASUS_SLP_REG_TIMEOUT     // units of PEGASUS_SLP_REG_TIMEOUT is minutes. Multiplying PEGASUS_SLP_REG_TIMEOUT
     // to convert in to seconds.     // to convert in to seconds.
     if (now.tv_sec - lastReregistrationTime.tv_sec > (PEGASUS_SLP_REG_TIMEOUT * 60))     if (now.tv_sec - lastReregistrationTime.tv_sec > (PEGASUS_SLP_REG_TIMEOUT * 60))
     {     {
        lastReregistrationTime.tv_sec = now.tv_sec;        lastReregistrationTime.tv_sec = now.tv_sec;
        // To allow the Reregistration _runSLP is made true. This flag is checked  #endif
        // in startSLPProvider()  
        _runSLP = true;  
        startSLPProvider();        startSLPProvider();
        //To disallow the registration call being made from the start of this routine.  #ifdef PEGASUS_SLP_REG_TIMEOUT
        _runSLP = false;  
     }     }
 #endif #endif
   #endif
       _monitor->run(500000);
   
       static struct timeval lastIdleCleanupTime = {0, 0};
  
     if (now.tv_sec - lastIdleCleanupTime.tv_sec >= 300)      if (now.tv_sec - lastIdleCleanupTime.tv_sec > 300)
     {     {
       lastIdleCleanupTime.tv_sec = now.tv_sec;       lastIdleCleanupTime.tv_sec = now.tv_sec;
       try       try
Line 1000 
Line 988 
 { {
  
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CIMServer::startSLPProvider");    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CIMServer::startSLPProvider");
     // onetime check is not needed for re-registration.     #ifndef PEGASUS_SLP_REG_TIMEOUT
     // This is a onetime function.  If already issued, or config is not to use simply     // This is a onetime function.  If already issued, or config is not to use simply
      // return
     if (!_runSLP)     if (!_runSLP)
     {     {
        return;        return;
     }     }
      #endif
     // Get Config parameter to determine if we should start SLP.     // Get Config parameter to determine if we should start SLP.
     ConfigManager* configManager = ConfigManager::getInstance();     ConfigManager* configManager = ConfigManager::getInstance();
     _runSLP = ConfigManager::parseBooleanValue(     _runSLP = ConfigManager::parseBooleanValue(
Line 1017 
Line 1006 
     {     {
        return;        return;
     }     }
       #ifndef PEGASUS_SLP_REG_TIMEOUT
     //SLP startup is onetime function; reset the switch so this     //SLP startup is onetime function; reset the switch so this
     // function does not get called a second time.     // function does not get called a second time.
     _runSLP = false;     _runSLP = false;
       #endif
     // Start SLPProvider for Built-in SA and Open SLP SA. If the     // Start SLPProvider for Built-in SA and Open SLP SA. If the
     // PEGASUS_SLP_REG_TIMEOUT is defined and if Open SLP is not used, start a     // PEGASUS_SLP_REG_TIMEOUT is defined and if Open SLP is not used, start a
     // thread which advertises CIMOM with a external SLP SA( i.e . IBM SA).     // thread which advertises CIMOM with a external SLP SA( i.e . IBM SA).
 #if defined( PEGASUS_SLP_REG_TIMEOUT ) && !defined( PEGASUS_USE_OPENSLP ) #if defined( PEGASUS_SLP_REG_TIMEOUT ) && !defined( PEGASUS_USE_OPENSLP )
     _startAdvThread = true;  
     Thread SLPThread(_advertisePegasus,0,true);     Thread SLPThread(_advertisePegasus,0,true);
     SLPThread.run();     SLPThread.run();
 #else #else
Line 1137 
Line 1126 
     char *httpAttrs  = (char *)NULL;     char *httpAttrs  = (char *)NULL;
     char *httpsAttrs  = (char *)NULL;     char *httpsAttrs  = (char *)NULL;
  
     if (!handleCloseSLPThread)  
     {  
        // Comes here only if the cimserver is not terminated.        // Comes here only if the cimserver is not terminated.
        // Get all the SLP attributes and data for the Pegasus cimserver.        // Get all the SLP attributes and data for the Pegasus cimserver.
        SLPHttpAttribObj.fillData("http");        SLPHttpAttribObj.fillData("http");
        SLPHttpsAttribObj.fillData("https");        SLPHttpsAttribObj.fillData("https");
        SLPHttpAttribObj.formAttributes();        SLPHttpAttribObj.formAttributes();
        SLPHttpsAttribObj.formAttributes();        SLPHttpsAttribObj.formAttributes();
     }  
  
     scopes = strdup("DEFAULT");     scopes = strdup("DEFAULT");
  
Line 1163 
Line 1149 
                                           FALSE,                                           FALSE,
                                           FALSE)))                                           FALSE)))
     {     {
        if (!handleCloseSLPThread)  
        {  
           int rc_http = client->srv_reg_local(client, httpUrl, httpAttrs, type, scopes, life);           int rc_http = client->srv_reg_local(client, httpUrl, httpAttrs, type, scopes, life);
           int rc_https = client->srv_reg_local(client, httpsUrl, httpsAttrs, type, scopes, life);           int rc_https = client->srv_reg_local(client, httpsUrl, httpsAttrs, type, scopes, life);
           if (!rc_http)           if (!rc_http)
           {           {
               PEGASUS_STD(cerr) << "CIMServer http registration is FAILED with External SLP" << PEGASUS_STD(endl);                PEG_TRACE_STRING(TRC_SERVER, Tracer::LEVEL2,
                                     "CIMServer http registration is FAILED with External SLP");
           }           }
           if (!rc_https)           if (!rc_https)
           {           {
               PEGASUS_STD(cerr) << "CIMServer https registration is FAILED with External SLP" << PEGASUS_STD(endl);                PEG_TRACE_STRING(TRC_SERVER, Tracer::LEVEL2,
           }                                    "CIMServer https registration is FAILED with External SLP");
        }        }
        destroy_slp_client(client);        destroy_slp_client(client);
     }     }
Line 1202 
Line 1187 
  
 // This routine deregisters the CIM Server registration with external SLP SA. // This routine deregisters the CIM Server registration with external SLP SA.
  
 int   _deregPegasus()  void  deregPegasus()
 { {
  
    PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::deregPegasus()");    PEG_METHOD_ENTER(TRC_SERVER, "CIMServer::deregPegasus()");
Line 1266 
Line 1251 
       free(iface);       free(iface);
  
    PEG_METHOD_EXIT();    PEG_METHOD_EXIT();
    return( 32 );     return;
 } }
 #endif #endif
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.190.2.7  
changed lines
  Added in v.1.190.2.9

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2