Ignore:
Timestamp:
Aug 14, 2009, 2:41:59 PM (13 years ago)
Author:
charles
Message:

(trunk libT) revision to r8910 for #2162: check to see if a field's value has actually changed before setting the "dirty" flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r8917 r8930  
    117117    assert( tr_isDirection( dir ) );
    118118
    119     tr_bandwidthSetDesiredSpeed( tor->bandwidth, dir, KiB_sec );
    120 
    121     tr_torrentSetDirty( tor );
     119    if( tr_bandwidthSetDesiredSpeed( tor->bandwidth, dir, KiB_sec ) )
     120        tr_torrentSetDirty( tor );
    122121}
    123122
     
    137136    assert( tr_isDirection( dir ) );
    138137
    139     tr_bandwidthSetLimited( tor->bandwidth, dir, do_use );
    140 
    141     tr_torrentSetDirty( tor );
     138    if( tr_bandwidthSetLimited( tor->bandwidth, dir, do_use ) )
     139        tr_torrentSetDirty( tor );
    142140}
    143141
     
    154152tr_torrentUseSessionLimits( tr_torrent * tor, tr_bool doUse )
    155153{
    156     assert( tr_isTorrent( tor ) );
    157 
    158     tr_bandwidthHonorParentLimits( tor->bandwidth, TR_UP, doUse );
    159     tr_bandwidthHonorParentLimits( tor->bandwidth, TR_DOWN, doUse );
    160 
    161     tr_torrentSetDirty( tor );
     154    tr_bool changed;
     155
     156    assert( tr_isTorrent( tor ) );
     157
     158    changed = tr_bandwidthHonorParentLimits( tor->bandwidth, TR_UP, doUse );
     159    changed |= tr_bandwidthHonorParentLimits( tor->bandwidth, TR_DOWN, doUse );
     160
     161    if( changed )
     162        tr_torrentSetDirty( tor );
    162163}
    163164
     
    180181    assert( mode==TR_RATIOLIMIT_GLOBAL || mode==TR_RATIOLIMIT_SINGLE || mode==TR_RATIOLIMIT_UNLIMITED  );
    181182
    182     tor->ratioLimitMode = mode;
    183     tor->needsSeedRatioCheck = TRUE;
    184 
    185     tr_torrentSetDirty( tor );
     183    if( mode != tor->ratioLimitMode )
     184    {
     185        tor->ratioLimitMode = mode;
     186        tor->needsSeedRatioCheck = TRUE;
     187
     188        tr_torrentSetDirty( tor );
     189    }
    186190}
    187191
     
    199203    assert( tr_isTorrent( tor ) );
    200204
    201     tor->desiredRatio = desiredRatio;
    202 
    203     tor->needsSeedRatioCheck = TRUE;
    204 
    205     tr_torrentSetDirty( tor );
     205    if( (int)(desiredRatio*100.0) != (int)(tor->desiredRatio*100.0) )
     206    {
     207        tor->desiredRatio = desiredRatio;
     208
     209        tor->needsSeedRatioCheck = TRUE;
     210
     211        tr_torrentSetDirty( tor );
     212    }
    206213}
    207214
     
    17921799    assert( tr_isPriority( priority ) );
    17931800
    1794     tor->bandwidth->priority = priority;
    1795 
    1796     tr_torrentSetDirty( tor );
     1801    if( tor->bandwidth->priority != priority )
     1802    {
     1803        tor->bandwidth->priority = priority;
     1804
     1805        tr_torrentSetDirty( tor );
     1806    }
    17971807}
    17981808
     
    20562066
    20572067void
    2058 tr_torrentSetActivityDate( tr_torrent * tor,
    2059                            time_t       t )
     2068tr_torrentSetActivityDate( tr_torrent * tor, time_t t )
    20602069{
    20612070    assert( tr_isTorrent( tor ) );
     
    20632072    tor->activityDate = t;
    20642073    tor->anyDate = MAX( tor->anyDate, tor->activityDate );
    2065     tr_torrentSetDirty( tor );
    20662074}
    20672075
Note: See TracChangeset for help on using the changeset viewer.