mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
add tr_blocklistExists( const tr_handle * );
This commit is contained in:
parent
a20bb8d569
commit
e5b04e45d5
3 changed files with 15 additions and 3 deletions
|
@ -59,7 +59,7 @@ main( void )
|
|||
|
||||
/* create our own dummy blocklist */
|
||||
createTestBlocklist( tmpfile );
|
||||
tr_setBlocklist( handle, tmpfile );
|
||||
tr_blocklistSet( handle, tmpfile );
|
||||
|
||||
/* now run some tests */
|
||||
check( !tr_netResolve( "216.16.1.143", &addr ) );
|
||||
|
|
|
@ -135,8 +135,18 @@ deleteBlocklist( tr_handle * handle UNUSED )
|
|||
unlink( filename );
|
||||
}
|
||||
|
||||
int
|
||||
tr_blocklistExists( const tr_handle * handle UNUSED )
|
||||
{
|
||||
struct stat st;
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
tr_getBlocklistFilename( filename, sizeof( filename ) );
|
||||
return !stat( filename, &st );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tr_setBlocklist( tr_handle * handle,
|
||||
tr_blocklistSet( tr_handle * handle,
|
||||
const char * filename )
|
||||
{
|
||||
FILE * in;
|
||||
|
|
|
@ -306,9 +306,11 @@ uint16_t tr_getGlobalPeerLimit( const tr_handle * handle );
|
|||
*
|
||||
* Passing NULL for a filename will clear the blocklist.
|
||||
*/
|
||||
void tr_setBlocklist( tr_handle * handle,
|
||||
void tr_blocklistSet( tr_handle * handle,
|
||||
const char * filename );
|
||||
|
||||
int tr_blocklistExists( const tr_handle * handle );
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in a new issue