***
**/
-static void
+static inline void
managerLock( const struct tr_peerMgr * manager )
{
tr_globalLock( manager->session );
}
-static void
+static inline void
managerUnlock( const struct tr_peerMgr * manager )
{
tr_globalUnlock( manager->session );
}
-static void
+static inline void
torrentLock( Torrent * torrent )
{
managerLock( torrent->manager );
}
-static void
+static inline void
torrentUnlock( Torrent * torrent )
{
managerUnlock( torrent->manager );
}
-static int
+static inline int
torrentIsLocked( const Torrent * t )
{
return tr_globalIsLocked( t->manager->session );
tr_trackerChangeMyPort( tor->tracker );
}
-tr_bool
-tr_torrentIsPrivate( const tr_torrent * tor )
-{
- return tor
- && tor->info.isPrivate;
-}
-
-tr_bool
-tr_torrentAllowsPex( const tr_torrent * tor )
-{
- return tor
- && tor->session->isPexEnabled
- && !tr_torrentIsPrivate( tor );
-}
-
static inline void
tr_torrentManualUpdateImpl( void * vtor )
{
tr_torrentUnlock( tor );
}
-tr_bool
-tr_torrentIsSeed( const tr_torrent * tor )
-{
- return tor->completeness != TR_LEECH;
-}
-
/**
*** File priorities
**/
****
***/
-tr_bool
-tr_torrentIsPieceChecked( const tr_torrent * tor,
- tr_piece_index_t piece )
-{
- return tr_bitfieldHas( &tor->checkedPieces, piece );
-}
-
void
tr_torrentSetPieceChecked( tr_torrent * tor,
tr_piece_index_t piece,
tr_file_index_t fileCount,
tr_bool do_download );
-tr_bool tr_torrentIsPrivate( const tr_torrent * );
-
void tr_torrentRecheckCompleteness( tr_torrent * );
void tr_torrentResetTransferStats( tr_torrent * );
tr_piece_index_t pieceIndex,
tr_bool has );
-tr_bool tr_torrentIsSeed( const tr_torrent * session );
-
void tr_torrentChangeMyPort( tr_torrent * session );
tr_torrent* tr_torrentFindFromId( tr_session * session,
tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session * session,
const uint8_t * hash );
-tr_bool tr_torrentAllowsPex( const tr_torrent * );
-
tr_bool tr_torrentIsPieceTransferAllowed( const tr_torrent * torrent,
tr_direction direction );
int tr_torrentCountUncheckedPieces( const tr_torrent * );
-tr_bool tr_torrentIsPieceChecked( const tr_torrent * tor,
- tr_piece_index_t piece );
-
tr_bool tr_torrentIsFileChecked( const tr_torrent * tor,
tr_file_index_t file );
: tor->blockSize;
}
-static inline void
-tr_torrentLock( const tr_torrent * tor )
+static inline void tr_torrentLock( const tr_torrent * tor )
{
tr_globalLock( tor->session );
}
-static inline void
-tr_torrentUnlock( const tr_torrent * tor )
+static inline void tr_torrentUnlock( const tr_torrent * tor )
{
tr_globalUnlock( tor->session );
}
return tr_torrentFindFromHash( (tr_session*)session, torrentHash ) != NULL;
}
+static inline tr_bool
+tr_torrentIsSeed( const tr_torrent * tor )
+{
+ return tor->completeness != TR_LEECH;
+}
+
+static inline tr_bool tr_torrentIsPrivate( const tr_torrent * tor )
+{
+ return ( tor != NULL ) && tor->info.isPrivate;
+}
+
+static inline tr_bool tr_torrentAllowsPex( const tr_torrent * tor )
+{
+ return ( tor != NULL ) && tor->session->isPexEnabled && !tr_torrentIsPrivate( tor );
+}
+
+static inline tr_bool tr_torrentIsPieceChecked( const tr_torrent * tor, tr_piece_index_t i )
+{
+ return tr_bitfieldHas( &tor->checkedPieces, i );
+}
#endif