(libT) more tr_bool, tr_port junk
This commit is contained in:
parent
63441d981d
commit
92dff35710
|
@ -381,7 +381,7 @@ tr_globalUnlock( struct tr_handle * handle )
|
|||
tr_lockUnlock( handle->lock );
|
||||
}
|
||||
|
||||
int
|
||||
tr_bool
|
||||
tr_globalIsLocked( const struct tr_handle * handle )
|
||||
{
|
||||
return handle && tr_lockHave( handle->lock );
|
||||
|
@ -395,35 +395,35 @@ tr_globalIsLocked( const struct tr_handle * handle )
|
|||
|
||||
struct bind_port_data
|
||||
{
|
||||
tr_handle * handle;
|
||||
int port;
|
||||
tr_session * session;
|
||||
tr_port port;
|
||||
};
|
||||
|
||||
static void
|
||||
tr_setBindPortImpl( void * vdata )
|
||||
{
|
||||
struct bind_port_data * data = vdata;
|
||||
tr_handle * handle = data->handle;
|
||||
const int port = data->port;
|
||||
tr_session * session = data->session;
|
||||
const tr_port port = data->port;
|
||||
|
||||
handle->isPortSet = 1;
|
||||
tr_sharedSetPort( handle->shared, port );
|
||||
session->isPortSet = 1;
|
||||
tr_sharedSetPort( session->shared, port );
|
||||
|
||||
tr_free( data );
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetPeerPort( tr_handle * handle,
|
||||
int port )
|
||||
tr_sessionSetPeerPort( tr_session * session,
|
||||
tr_port port )
|
||||
{
|
||||
struct bind_port_data * data = tr_new( struct bind_port_data, 1 );
|
||||
|
||||
data->handle = handle;
|
||||
data->session = session;
|
||||
data->port = port;
|
||||
tr_runInEventThread( handle, tr_setBindPortImpl, data );
|
||||
tr_runInEventThread( session, tr_setBindPortImpl, data );
|
||||
}
|
||||
|
||||
int
|
||||
tr_port
|
||||
tr_sessionGetPeerPort( const tr_handle * h )
|
||||
{
|
||||
assert( h );
|
||||
|
@ -688,16 +688,16 @@ tr_sessionLoadTorrents( tr_handle * h,
|
|||
***/
|
||||
|
||||
void
|
||||
tr_sessionSetPexEnabled( tr_handle * handle,
|
||||
int enabled )
|
||||
tr_sessionSetPexEnabled( tr_session * session,
|
||||
tr_bool enabled )
|
||||
{
|
||||
handle->isPexEnabled = enabled ? 1 : 0;
|
||||
session->isPexEnabled = enabled != 0;
|
||||
}
|
||||
|
||||
int
|
||||
tr_sessionIsPexEnabled( const tr_handle * handle )
|
||||
tr_bool
|
||||
tr_sessionIsPexEnabled( const tr_session * session )
|
||||
{
|
||||
return handle->isPexEnabled;
|
||||
return session->isPexEnabled;
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -705,16 +705,16 @@ tr_sessionIsPexEnabled( const tr_handle * handle )
|
|||
***/
|
||||
|
||||
void
|
||||
tr_sessionSetLazyBitfieldEnabled( tr_handle * handle,
|
||||
int enabled )
|
||||
tr_sessionSetLazyBitfieldEnabled( tr_session * session,
|
||||
tr_bool enabled )
|
||||
{
|
||||
handle->useLazyBitfield = enabled ? 1 : 0;
|
||||
session->useLazyBitfield = enabled != 0;
|
||||
}
|
||||
|
||||
int
|
||||
tr_sessionIsLazyBitfieldEnabled( const tr_handle * handle )
|
||||
tr_bool
|
||||
tr_sessionIsLazyBitfieldEnabled( const tr_session * session )
|
||||
{
|
||||
return handle->useLazyBitfield;
|
||||
return session->useLazyBitfield;
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -722,15 +722,15 @@ tr_sessionIsLazyBitfieldEnabled( const tr_handle * handle )
|
|||
***/
|
||||
|
||||
void
|
||||
tr_sessionSetPortForwardingEnabled( tr_handle * h,
|
||||
int enable )
|
||||
tr_sessionSetPortForwardingEnabled( tr_session * session,
|
||||
tr_bool enabled )
|
||||
{
|
||||
tr_globalLock( h );
|
||||
tr_sharedTraversalEnable( h->shared, enable );
|
||||
tr_globalUnlock( h );
|
||||
tr_globalLock( session );
|
||||
tr_sharedTraversalEnable( session->shared, enabled );
|
||||
tr_globalUnlock( session );
|
||||
}
|
||||
|
||||
int
|
||||
tr_bool
|
||||
tr_sessionIsPortForwardingEnabled( const tr_handle * h )
|
||||
{
|
||||
return tr_sharedTraversalIsEnabled( h->shared );
|
||||
|
@ -751,7 +751,7 @@ tr_blocklistGetRuleCount( const tr_session * session )
|
|||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
tr_bool
|
||||
tr_blocklistIsEnabled( const tr_session * session )
|
||||
{
|
||||
return session->isBlocklistEnabled;
|
||||
|
@ -769,7 +769,7 @@ tr_blocklistSetEnabled( tr_session * session,
|
|||
_tr_blocklistSetEnabled( l->data, isEnabled );
|
||||
}
|
||||
|
||||
int
|
||||
tr_bool
|
||||
tr_blocklistExists( const tr_session * session )
|
||||
{
|
||||
return session->blocklists != NULL;
|
||||
|
@ -799,7 +799,7 @@ tr_blocklistSetContent( tr_session * session,
|
|||
return _tr_blocklistSetContent( b, contentFilename );
|
||||
}
|
||||
|
||||
int
|
||||
tr_bool
|
||||
tr_sessionIsAddressBlocked( const tr_session * session,
|
||||
const tr_address * addr )
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ void tr_sessionSetTorrentFile( tr_session * session,
|
|||
const char * hashString,
|
||||
const char * filename );
|
||||
|
||||
int tr_sessionIsAddressBlocked( const tr_session * session,
|
||||
tr_bool tr_sessionIsAddressBlocked( const tr_session * session,
|
||||
const struct tr_address * addr );
|
||||
|
||||
|
||||
|
@ -130,6 +130,6 @@ void tr_globalLock( tr_session * );
|
|||
|
||||
void tr_globalUnlock( tr_session * );
|
||||
|
||||
int tr_globalIsLocked( const tr_session * );
|
||||
tr_bool tr_globalIsLocked( const tr_session * );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -512,14 +512,14 @@ void tr_sessionClearStats( tr_session * session );
|
|||
* In public torrents, PEX is enabled by default.
|
||||
*/
|
||||
void tr_sessionSetPexEnabled( tr_session * session,
|
||||
int isEnabled );
|
||||
tr_bool isEnabled );
|
||||
|
||||
int tr_sessionIsPexEnabled( const tr_session * session );
|
||||
tr_bool tr_sessionIsPexEnabled( const tr_session * session );
|
||||
|
||||
void tr_sessionSetLazyBitfieldEnabled( tr_session * session,
|
||||
int enabled );
|
||||
tr_bool enabled );
|
||||
|
||||
int tr_sessionIsLazyBitfieldEnabled( const tr_session * session );
|
||||
tr_bool tr_sessionIsLazyBitfieldEnabled( const tr_session * session );
|
||||
|
||||
tr_encryption_mode tr_sessionGetEncryption( tr_session * session );
|
||||
|
||||
|
@ -532,14 +532,14 @@ void tr_sessionSetEncryption( tr_session * session,
|
|||
*/
|
||||
|
||||
void tr_sessionSetPortForwardingEnabled( tr_session * session,
|
||||
int enabled );
|
||||
tr_bool enabled );
|
||||
|
||||
int tr_sessionIsPortForwardingEnabled( const tr_session * session );
|
||||
tr_bool tr_sessionIsPortForwardingEnabled( const tr_session * session );
|
||||
|
||||
void tr_sessionSetPeerPort( tr_session * session,
|
||||
int port);
|
||||
tr_port port);
|
||||
|
||||
int tr_sessionGetPeerPort( const tr_session * session );
|
||||
tr_port tr_sessionGetPeerPort( const tr_session * session );
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -553,7 +553,7 @@ tr_port_forwarding;
|
|||
|
||||
tr_port_forwarding tr_sessionGetPortForwarding( const tr_session * session );
|
||||
|
||||
int tr_sessionCountTorrents( const tr_session * session );
|
||||
int tr_sessionCountTorrents( const tr_session * session );
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -673,17 +673,17 @@ void tr_freeMessageList( tr_msg_list * freeme );
|
|||
*
|
||||
* Passing NULL for a filename will clear the blocklist.
|
||||
*/
|
||||
int tr_blocklistSetContent( tr_session * session,
|
||||
const char * filename );
|
||||
int tr_blocklistSetContent ( tr_session * session,
|
||||
const char * filename );
|
||||
|
||||
int tr_blocklistGetRuleCount( const tr_session * session );
|
||||
int tr_blocklistGetRuleCount ( const tr_session * session );
|
||||
|
||||
int tr_blocklistExists( const tr_session * session );
|
||||
tr_bool tr_blocklistExists ( const tr_session * session );
|
||||
|
||||
int tr_blocklistIsEnabled( const tr_session * session );
|
||||
tr_bool tr_blocklistIsEnabled ( const tr_session * session );
|
||||
|
||||
void tr_blocklistSetEnabled( tr_session * session,
|
||||
tr_bool isEnabled );
|
||||
void tr_blocklistSetEnabled ( tr_session * session,
|
||||
tr_bool isEnabled );
|
||||
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Reference in New Issue