remove unused macros. constify some tracker functions.
This commit is contained in:
parent
790476ac23
commit
9f16191b0e
|
@ -272,7 +272,7 @@ static int shouldConnect( tr_tracker_t * tc )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shouldScrape( tr_tracker_t * tc )
|
static int shouldScrape( const tr_tracker_t * tc )
|
||||||
{
|
{
|
||||||
uint64_t now, interval;
|
uint64_t now, interval;
|
||||||
|
|
||||||
|
@ -296,8 +296,10 @@ static int shouldScrape( tr_tracker_t * tc )
|
||||||
return now > tc->dateScrape + interval;
|
return now > tc->dateScrape + interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tr_trackerAnnouncePulse( tr_tracker_t * tc, int * peerCount,
|
void
|
||||||
uint8_t ** peerCompact, int manual )
|
tr_trackerPulse( tr_tracker_t * tc,
|
||||||
|
int * peerCount,
|
||||||
|
uint8_t ** peerCompact )
|
||||||
{
|
{
|
||||||
const char * data;
|
const char * data;
|
||||||
char * address, * announce;
|
char * address, * announce;
|
||||||
|
@ -311,15 +313,9 @@ void tr_trackerAnnouncePulse( tr_tracker_t * tc, int * peerCount,
|
||||||
*peerCount = 0;
|
*peerCount = 0;
|
||||||
*peerCompact = NULL;
|
*peerCompact = NULL;
|
||||||
|
|
||||||
if( ( NULL == tc->http ) && ( manual || shouldConnect( tc ) ) )
|
if( ( NULL == tc->http ) && shouldConnect( tc ) )
|
||||||
{
|
{
|
||||||
/* if announcing manually, don't consider not reaching a
|
tc->completelyUnconnectable = FALSE;
|
||||||
tracker an error */
|
|
||||||
if( manual )
|
|
||||||
{
|
|
||||||
tc->allUnreachIfError = 0;
|
|
||||||
}
|
|
||||||
tc->completelyUnconnectable = 0;
|
|
||||||
|
|
||||||
tc->randOffset = tr_rand( 60000 );
|
tc->randOffset = tr_rand( 60000 );
|
||||||
|
|
||||||
|
@ -978,31 +974,19 @@ static void readScrapeAnswer( tr_tracker_t * tc, const char * data, int len )
|
||||||
tr_bencFree( &scrape );
|
tr_bencFree( &scrape );
|
||||||
}
|
}
|
||||||
|
|
||||||
int tr_trackerSeeders( tr_tracker_t * tc )
|
int tr_trackerSeeders( const tr_tracker_t * tc )
|
||||||
{
|
{
|
||||||
if( !tc )
|
return tc ? tc->seeders : -1;
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return tc->seeders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tr_trackerLeechers( tr_tracker_t * tc )
|
int tr_trackerLeechers( const tr_tracker_t * tc )
|
||||||
{
|
{
|
||||||
if( !tc )
|
return tc ? tc->leechers : -1;
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return tc->leechers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tr_trackerDownloaded( tr_tracker_t * tc )
|
int tr_trackerDownloaded( const tr_tracker_t * tc )
|
||||||
{
|
{
|
||||||
if( !tc )
|
return tc ? tc->complete : -1;
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return tc->complete;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc )
|
tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc )
|
||||||
|
@ -1014,13 +998,9 @@ tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc )
|
||||||
return tc->tcCur->tl_inf;
|
return tc->tcCur->tl_inf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tr_trackerCannotConnect( tr_tracker_t * tc )
|
int tr_trackerCannotConnect( const tr_tracker_t * tc )
|
||||||
{
|
{
|
||||||
if( !tc )
|
return tc && tc->completelyUnconnectable;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return tc->completelyUnconnectable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Blocking version */
|
/* Blocking version */
|
||||||
|
|
|
@ -29,9 +29,9 @@ typedef struct tr_tracker_s tr_tracker_t;
|
||||||
|
|
||||||
tr_tracker_t * tr_trackerInit ( tr_torrent_t * );
|
tr_tracker_t * tr_trackerInit ( tr_torrent_t * );
|
||||||
|
|
||||||
#define tr_trackerPulse(tc,a,b) tr_trackerAnnouncePulse((tc),(a),(b),0)
|
void tr_trackerPulse ( tr_tracker_t *,
|
||||||
void tr_trackerAnnouncePulse( tr_tracker_t *, int * peerCount,
|
int * peerCount,
|
||||||
uint8_t ** peerCompact, int );
|
uint8_t ** peerCompact );
|
||||||
|
|
||||||
void tr_trackerCompleted( tr_tracker_t * );
|
void tr_trackerCompleted( tr_tracker_t * );
|
||||||
void tr_trackerStopped ( tr_tracker_t * );
|
void tr_trackerStopped ( tr_tracker_t * );
|
||||||
|
@ -42,14 +42,14 @@ void tr_trackerClose ( tr_tracker_t * );
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
* Looks for the seeders as returned by the tracker.
|
* Looks for the seeders as returned by the tracker.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
int tr_trackerSeeders ( tr_tracker_t * );
|
int tr_trackerSeeders ( const tr_tracker_t * );
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* tr_trackerLeechers
|
* tr_trackerLeechers
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
* Looks for the leechers as returned by the tracker.
|
* Looks for the leechers as returned by the tracker.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
int tr_trackerLeechers ( tr_tracker_t * );
|
int tr_trackerLeechers ( const tr_tracker_t * );
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* tr_trackerDownloaded
|
* tr_trackerDownloaded
|
||||||
|
@ -57,7 +57,7 @@ int tr_trackerLeechers ( tr_tracker_t * );
|
||||||
* Looks for number of completed downloads as returned by the tracker
|
* Looks for number of completed downloads as returned by the tracker
|
||||||
* (from scrape).
|
* (from scrape).
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
int tr_trackerDownloaded( tr_tracker_t * tc );
|
int tr_trackerDownloaded( const tr_tracker_t * tc );
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* tr_trackerGet
|
* tr_trackerGet
|
||||||
|
@ -66,7 +66,7 @@ int tr_trackerDownloaded( tr_tracker_t * tc );
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc );
|
tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc );
|
||||||
|
|
||||||
int tr_trackerCannotConnect( tr_tracker_t * tc );
|
int tr_trackerCannotConnect( const tr_tracker_t * tc );
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* tr_trackerScrape
|
* tr_trackerScrape
|
||||||
|
|
Loading…
Reference in New Issue