support manual announcing to tracker (as in user forces an announce) in libT...when implemented in a front end it should limit the use of this

This commit is contained in:
Mitchell Livingston 2006-12-26 04:17:37 +00:00
parent 36c2d957f2
commit f57626a6b1
2 changed files with 13 additions and 4 deletions

View File

@ -92,6 +92,7 @@ struct tr_tracker_s
static int announceToScrape ( char * announce, char * scrape );
static void setAnnounce ( tr_tracker_t * tc, tr_announce_list_ptr_t * announceItem );
static void failureAnnouncing( tr_tracker_t * tc );
void trackerPulse ( tr_tracker_t *, int );
static tr_http_t * getQuery ( tr_tracker_t * tc );
static tr_http_t * getScrapeQuery ( tr_tracker_t * tc );
static void readAnswer ( tr_tracker_t * tc, const char *, int );
@ -322,7 +323,7 @@ void tr_trackerChangePort( tr_tracker_t * tc, int port )
tc->newPort = port;
}
void tr_trackerPulse( tr_tracker_t * tc )
void trackerPulse( tr_tracker_t * tc, int manual )
{
tr_torrent_t * tor = tc->tor;
tr_info_t * inf = &tor->info;
@ -331,9 +332,14 @@ void tr_trackerPulse( tr_tracker_t * tc )
int len, i, port;
tr_announce_list_ptr_t * announcePtr, * prevAnnouncePtr;
if( ( NULL == tc->http ) && shouldConnect( tc ) )
if( ( NULL == tc->http ) && ( manual || shouldConnect( tc ) ) )
{
if( manual )
{
tc->allUnreachIfError = 0;
}
tc->completelyUnconnectable = 0;
tc->randOffset = tr_rand( 60000 );
if( tr_fdSocketWillCreate( tor->fdlimit, 1 ) )

View File

@ -29,7 +29,10 @@ typedef struct tr_tracker_s tr_tracker_t;
tr_tracker_t * tr_trackerInit ( tr_torrent_t * );
void tr_trackerChangePort( tr_tracker_t *, int );
void tr_trackerPulse ( tr_tracker_t * );
#define tr_trackerPulse( tc ) trackerPulse( (tc), 0 )
#define tr_trackerPulseManual( tc ) trackerPulse( (tc), 1 )
void tr_trackerCompleted ( tr_tracker_t * );
void tr_trackerStopped ( tr_tracker_t * );
void tr_trackerClose ( tr_tracker_t * );