mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
#765, part 1: add backend support for disabling tracker scrapes
This commit is contained in:
parent
6d52fa6856
commit
16880cee99
4 changed files with 33 additions and 10 deletions
|
@ -55,6 +55,13 @@ const uint8_t* tr_getPeerId( void );
|
|||
|
||||
struct tr_handle
|
||||
{
|
||||
unsigned int isScrapeEnabled : 1;
|
||||
unsigned int isPortSet : 1;
|
||||
unsigned int isPexEnabled : 1;
|
||||
unsigned int isClosed : 1;
|
||||
unsigned int useUploadLimit : 1;
|
||||
unsigned int useDownloadLimit : 1;
|
||||
|
||||
tr_encryption_mode encryptionMode;
|
||||
|
||||
struct tr_event_handle * events;
|
||||
|
@ -63,11 +70,7 @@ struct tr_handle
|
|||
tr_torrent * torrentList;
|
||||
|
||||
char * tag;
|
||||
unsigned int isPortSet : 1;
|
||||
unsigned int isPexEnabled : 1;
|
||||
|
||||
char useUploadLimit;
|
||||
char useDownloadLimit;
|
||||
struct tr_ratecontrol * upload;
|
||||
struct tr_ratecontrol * download;
|
||||
|
||||
|
@ -80,8 +83,6 @@ struct tr_handle
|
|||
tr_handle_status stats[2];
|
||||
int statCur;
|
||||
|
||||
uint8_t isClosed;
|
||||
|
||||
struct tr_stats_handle * sessionStats;
|
||||
struct tr_tracker_handle * tracker;
|
||||
};
|
||||
|
|
|
@ -178,7 +178,8 @@ trackerSupportsScrape( const tr_tracker * t )
|
|||
{
|
||||
const tr_tracker_info * info = getCurrentAddress( t );
|
||||
|
||||
return ( info != NULL )
|
||||
return ( t->handle->isScrapeEnabled )
|
||||
&& ( info != NULL )
|
||||
&& ( info->scrape != NULL )
|
||||
&& ( info->scrape[0] != '\0' );
|
||||
}
|
||||
|
|
|
@ -305,9 +305,10 @@ tr_setUseGlobalSpeedLimit( tr_handle * h,
|
|||
int up_or_down,
|
||||
int use_flag )
|
||||
{
|
||||
char * ch = up_or_down==TR_UP ? &h->useUploadLimit
|
||||
: &h->useDownloadLimit;
|
||||
*ch = use_flag;
|
||||
if( up_or_down == TR_UP )
|
||||
h->useUploadLimit = use_flag ? 1 : 0;
|
||||
else
|
||||
h->useDownloadLimit = use_flag ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -530,3 +531,19 @@ tr_blocklistHasAddress( tr_handle * handle, const struct in_addr * addr )
|
|||
{
|
||||
return _tr_blocklistHasAddress( handle->blocklist, addr );
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void
|
||||
tr_setScrapeEnabled( tr_handle * handle, int isEnabled )
|
||||
{
|
||||
handle->isScrapeEnabled = isEnabled ? 1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
tr_isScrapeEnabled( const tr_handle * handle )
|
||||
{
|
||||
return handle->isScrapeEnabled;
|
||||
}
|
||||
|
|
|
@ -603,6 +603,10 @@ void tr_manualUpdate( tr_torrent * );
|
|||
|
||||
int tr_torrentCanManualUpdate( const tr_torrent * );
|
||||
|
||||
void tr_setScrapeEnabled( tr_handle * , int isEnabled );
|
||||
|
||||
int tr_isScrapeEnabled( const tr_handle * );
|
||||
|
||||
/***********************************************************************
|
||||
* tr_torrentStat
|
||||
***********************************************************************
|
||||
|
|
Loading…
Add table
Reference in a new issue