Changeset 3467


Ignore:
Timestamp:
Oct 19, 2007, 9:53:35 PM (14 years ago)
Author:
charles
Message:

sending SIGHUP in the cli will now ask the tracker for more peers. (#306, suggested by mtolman, patch by tiennou)

Location:
trunk/cli
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/transmissioncli.1

    r3401 r3467  
    9393.It Fl f, -finish Ar script
    9494Specifies a shell script to be executed upon successful download.
     95.Sh SIGNALS
     96In addition to these options, sending
     97.Nm
     98a SIGHUP signal can ask the tracker for more peers.
    9599.El
    96100.Sh FILES
  • trunk/cli/transmissioncli.c

    r3426 r3467  
    8585static int           natTraversal  = 0;
    8686static sig_atomic_t  gotsig        = 0;
     87static sig_atomic_t  manualUpdate  = 0;
    8788static tr_torrent    * tor;
    8889
     
    245246
    246247    signal( SIGINT, sigHandler );
     248    signal( SIGHUP, sigHandler );
    247249
    248250    tr_setBindPort( h, bindPort );
     
    271273            tr_natTraversalEnable( h, 0 );
    272274        }
     275       
     276        if( manualUpdate )
     277        {
     278            manualUpdate = 0;
     279            if ( !tr_torrentCanManualUpdate( tor ) ) {
     280                fprintf( stderr, "\rReceived SIGHUP, but can't send a manual update now\n" );
     281            else {
     282                fprintf( stderr, "\rReceived SIGHUP: manual update scheduled\n" );
     283                tr_manualUpdate( tor );
     284            }
     285        }
    273286
    274287        s = tr_torrentStat( tor );
     
    277290        {
    278291            chars = snprintf( string, sizeof string,
    279                 "Waiting to check files... %.2f %%", 100.0 * s->percentDone );
     292                "Waiting to verify local files... %.2f %%", 100.0 * s->percentDone );
    280293        }
    281294        else if( s->status & TR_STATUS_CHECK )
    282295        {
    283296            chars = snprintf( string, sizeof string,
    284                 "Checking files... %.2f %%", 100.0 * s->percentDone );
     297                "Verifying local files... %.2f %%", 100.0 * s->percentDone );
    285298        }
    286299        else if( s->status & TR_STATUS_DOWNLOAD )
     
    439452            gotsig = 1;
    440453            break;
     454           
     455        case SIGHUP:
     456            manualUpdate = 1;
     457            break;
    441458
    442459        default:
Note: See TracChangeset for help on using the changeset viewer.