Update 2005-11-26

This commit is contained in:
Eric Petit 2006-01-12 18:43:18 +00:00
parent 835c3284dd
commit 5b06d13781
2 changed files with 20 additions and 6 deletions

View File

@ -564,14 +564,14 @@ int tr_trackerScrape( tr_torrent_t * tor, int * seeders, int * leechers )
return 1;
}
for( i = 0; i < ret - 8; i++ )
for( i = 0; i < pos - 8; i++ )
{
if( !memcmp( &buf[i], "d5:files", 8 ) )
{
break;
}
}
if( i >= ret - 8 )
if( i >= pos - 8 )
{
return 1;
}
@ -623,4 +623,4 @@ int tr_trackerLeechers( tr_torrent_t * tor)
return (tor->tracker)->leechers;
}
return 0;
}
}

View File

@ -40,7 +40,8 @@
" -s, --scrape Print counts of seeders/leechers and exit\n" \
" -v, --verbose <int> Verbose level (0 to 2, default = 0)\n" \
" -p, --port <int> Port we should listen on (default = %d)\n" \
" -u, --upload <int> Maximum upload rate (-1 = no limit, default = 20)\n"
" -u, --upload <int> Maximum upload rate (-1 = no limit, default = 20)\n" \
" -f, --finish <shell script> Command you wish to run on completion\n"
static int showHelp = 0;
static int showInfo = 0;
@ -51,6 +52,8 @@ static int uploadLimit = 20;
static char * torrentPath = NULL;
static volatile char mustDie = 0;
static char * finishCall = NULL;
static int parseCommandLine ( int argc, char ** argv );
static void sigHandler ( int signal );
@ -166,6 +169,7 @@ int main( int argc, char ** argv )
{
char string[80];
int chars = 0;
int result;
sleep( 1 );
@ -204,6 +208,12 @@ int main( int argc, char ** argv )
{
fprintf( stderr, "\n" );
}
if( tr_getFinished( h, 0 ) )
{
tr_setFinished( h, 0, 0 );
result = system(finishCall);
}
free( s );
}
@ -244,10 +254,11 @@ static int parseCommandLine( int argc, char ** argv )
{ "verbose", required_argument, NULL, 'v' },
{ "port", required_argument, NULL, 'p' },
{ "upload", required_argument, NULL, 'u' },
{ 0, 0, 0, 0 } };
{ "finish", required_argument, NULL, 'f' },
{ 0, 0, 0, 0} };
int c, optind = 0;
c = getopt_long( argc, argv, "hisv:p:u:", long_options, &optind );
c = getopt_long( argc, argv, "hisv:p:u:f:", long_options, &optind );
if( c < 0 )
{
break;
@ -272,6 +283,9 @@ static int parseCommandLine( int argc, char ** argv )
case 'u':
uploadLimit = atoi( optarg );
break;
case 'f':
finishCall = optarg;
break;
default:
return 1;
}