Esempio n. 1
0
/*------------------------------------------------------------------------*/
void HandleSigHup()
/*------------------------------------------------------------------------*/
{
    /* Reinitialize */
    SLPLog("****************************************\n");
    SLPLogTime();
    SLPLog("SLPD daemon reset by SIGHUP\n");
    SLPLog("****************************************\n\n");
    
    /* unregister with all DAs */
    SLPDKnownDADeinit();
    
    /* re-read properties */
    SLPDPropertyInit(G_SlpdCommandLine.cfgfile);
    
    /* Re-read the static registration file (slp.reg)*/
    SLPDDatabaseReInit(G_SlpdCommandLine.regfile);

    /* Rebuild Known DA database */
    SLPDKnownDAInit();
    
    SLPLog("****************************************\n");
    SLPLogTime();
    SLPLog("SLPD daemon reset finished\n");
    SLPLog("****************************************\n\n");
}
Esempio n. 2
0
/** Handles a SIG_HUP signal from the system.
 *
 * @internal
 */
static void HandleSigHup(void)
{
   /* Reinitialize */
   SLPDLog("****************************************\n");
   SLPDLogTime();
   SLPDLog("SLPD daemon reset by SIGHUP\n");
   SLPDLog("****************************************\n\n");

   /* unregister with all DAs */
   SLPDKnownDADeinit();

   /* re-read properties */
   SLPDPropertyReinit();

#ifdef ENABLE_SLPv2_SECURITY
   /* Re-initialize SPI stuff*/
   SLPDSpiInit(G_SlpdCommandLine.spifile);
#endif

   /* Re-read the static registration file (slp.reg)*/
   SLPDDatabaseReInit(G_SlpdCommandLine.regfile);

   /* Rebuild Known DA database */
   SLPDKnownDAInit();

   SLPDLog("****************************************\n");
   SLPDLogTime();
   SLPDLog("SLPD daemon reset finished\n");
   SLPDLog("****************************************\n\n");
}
Esempio n. 3
0
/*------------------------------------------------------------------------*/
void HandleSigTerm()
/*------------------------------------------------------------------------*/
{
    struct timeval  timeout;
    fd_set          readfds;
    fd_set          writefds;
    int             highfd          = 0;
    int             fdcount         = 0;

    SLPDLog("****************************************\n");
    SLPDLogTime();
    SLPDLog("SLPD daemon shutting down\n");
    SLPDLog("****************************************\n");

    /* close all incoming sockets */
    SLPDIncomingDeinit();

    /* unregister with all DAs */
    SLPDKnownDADeinit();

    timeout.tv_sec  = 5;
    timeout.tv_usec = 0; 

    /* Do a dead DA passive advert to tell everyone we're goin' down */
    SLPDKnownDAPassiveDAAdvert(0, 1);

    /* if possible wait until all outgoing socket are done and closed */
    while(SLPDOutgoingDeinit(1))
    {
        FD_ZERO(&writefds);
        FD_ZERO(&readfds);
        LoadFdSets(&G_OutgoingSocketList, &highfd, &readfds,&writefds);
        fdcount = select(highfd+1,&readfds,&writefds,0,&timeout);
        if(fdcount == 0)
        {
            break;
        }

        SLPDOutgoingHandler(&fdcount,&readfds,&writefds);
    }

    SLPDOutgoingDeinit(0);

    SLPDLog("****************************************\n");
    SLPDLogTime();
    SLPDLog("SLPD daemon shut down\n");
    SLPDLog("****************************************\n");

#ifdef DEBUG
    #ifdef ENABLE_SECURITY
    SLPDSpiDeinit();
    #endif
    SLPDDatabaseDeinit();
    SLPDPropertyDeinit();
    xmalloc_deinit();    
#endif

}