Changeset 9390 for trunk/daemon/daemon.c


Ignore:
Timestamp:
Oct 24, 2009, 4:18:40 PM (9 years ago)
Author:
charles
Message:

(trunk) add SIGKILL handling to daemon, gtk clients. This is revision of r9387 for #2119

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r9388 r9390  
    103103
    104104static void
    105 got_sigint( int sig UNUSED )
    106 {
    107     closing = TRUE;
    108 }
    109 
    110 static void
    111 got_sighup( int sig UNUSED )
    112 {
    113     tr_benc settings;
    114     const char * configDir = tr_sessionGetConfigDir( mySession );
    115 
    116     /* reload the settings */
    117     tr_inf( "Reloading settings from \"%s\"", configDir );
    118     tr_bencInitDict( &settings, 0 );
    119     tr_sessionLoadSettings( &settings, configDir, MY_NAME );
    120     tr_sessionSet( mySession, &settings );
    121 
    122     /* cleanup */
    123     tr_bencFree( &settings );
     105gotsig( int sig )
     106{
     107    switch( sig )
     108    {
     109        case SIGHUP:
     110        {
     111            tr_benc settings;
     112            const char * configDir = tr_sessionGetConfigDir( mySession );
     113            tr_inf( "Reloading settings from \"%s\"", configDir );
     114            tr_bencInitDict( &settings, 0 );
     115            tr_sessionLoadSettings( &settings, configDir, MY_NAME );
     116            tr_sessionSet( mySession, &settings );
     117            tr_bencFree( &settings );
     118        }
     119
     120        default:
     121            closing = TRUE;
     122    }
    124123}
    125124
     
    282281    dtr_watchdir * watchdir = NULL;
    283282
    284     signal( SIGINT, got_sigint );
     283    signal( SIGINT, gotsig );
     284    signal( SIGKILL, gotsig );
    285285#ifndef WIN32
    286     signal( SIGHUP, got_sighup );
     286    signal( SIGHUP, gotsig );
    287287#endif
    288288
Note: See TracChangeset for help on using the changeset viewer.