Changeset 9390


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

Location:
trunk
Files:
2 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
  • trunk/gtk/main.c

    r9387 r9390  
    273273    {
    274274        case SIGINT:
     275        case SIGKILL:
    275276            g_message( _( "Got signal %d; trying to shut down cleanly.  Do it again if it gets stuck." ), sig );
    276277            doAction( "quit", sighandler_cbdata );
    277278            break;
     279
     280        default:
     281            g_message( "unhandled signal" );
    278282    }
    279283}
     
    283287{
    284288    signal( SIGINT, signal_handler );
     289    signal( SIGKILL, signal_handler );
    285290}
    286291
Note: See TracChangeset for help on using the changeset viewer.