Ignore:
Timestamp:
Jan 18, 2011, 11:44:36 PM (11 years ago)
Author:
jordan
Message:

cleanup of who calls the libtransmission thread locking functions.

In some cases we were calling them from deep inside libtransmission, when they should have been called directly from the public-visible API functions: tr_torrentWebSpeeds_KBps(), tr_torrentPeers(), tr_torrentTrackers().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r11704 r11706  
    13991399tr_torrentWebSpeeds_KBps( const tr_torrent * tor )
    14001400{
    1401     return tr_isTorrent( tor ) ? tr_peerMgrWebSpeeds_KBps( tor ) : NULL;
     1401    double * ret = NULL;
     1402
     1403    if( tr_isTorrent( tor ) )
     1404    {
     1405        tr_torrentLock( tor );
     1406        ret = tr_peerMgrWebSpeeds_KBps( tor );
     1407        tr_torrentUnlock( tor );
     1408    }
     1409
     1410    return ret;
    14021411}
    14031412
    14041413tr_peer_stat *
    1405 tr_torrentPeers( const tr_torrent * tor,
    1406                  int *              peerCount )
     1414tr_torrentPeers( const tr_torrent * tor, int * peerCount )
    14071415{
    14081416    tr_peer_stat * ret = NULL;
    14091417
    14101418    if( tr_isTorrent( tor ) )
     1419    {
     1420        tr_torrentLock( tor );
    14111421        ret = tr_peerMgrPeerStats( tor, peerCount );
     1422        tr_torrentUnlock( tor );
     1423    }
    14121424
    14131425    return ret;
     
    14151427
    14161428void
    1417 tr_torrentPeersFree( tr_peer_stat * peers,
    1418                      int peerCount  UNUSED )
     1429tr_torrentPeersFree( tr_peer_stat * peers, int peerCount UNUSED )
    14191430{
    14201431    tr_free( peers );
     
    14221433
    14231434tr_tracker_stat *
    1424 tr_torrentTrackers( const tr_torrent * torrent,
    1425                     int              * setmeTrackerCount )
    1426 {
    1427     assert( tr_isTorrent( torrent ) );
    1428 
    1429     return tr_announcerStats( torrent, setmeTrackerCount );
    1430 }
    1431 
    1432 void
    1433 tr_torrentTrackersFree( tr_tracker_stat * trackers,
    1434                         int trackerCount )
     1435tr_torrentTrackers( const tr_torrent * torrent, int * setmeTrackerCount )
     1436{
     1437    tr_tracker_stat * ret = NULL;
     1438
     1439    if( tr_isTorrent( torrent ) )
     1440    {
     1441        tr_torrentLock( torrent );
     1442        ret = tr_announcerStats( torrent, setmeTrackerCount );
     1443        tr_torrentUnlock( torrent );
     1444    }
     1445
     1446    return ret;
     1447}
     1448
     1449void
     1450tr_torrentTrackersFree( tr_tracker_stat * trackers, int trackerCount )
    14351451{
    14361452    tr_announcerStatsFree( trackers, trackerCount );
     
    17231739    assert( tr_isTorrent( tor ) );
    17241740
     1741    tr_torrentLock( tor );
     1742
    17251743    tr_verifyRemove( tor );
    17261744    tr_peerMgrStopTorrent( tor );
     
    17321750    if( !tor->isDeleting )
    17331751        tr_torrentSave( tor );
     1752
     1753    tr_torrentUnlock( tor );
    17341754}
    17351755
Note: See TracChangeset for help on using the changeset viewer.