Ignore:
Timestamp:
Dec 19, 2007, 2:44:21 AM (15 years ago)
Author:
charles
Message:

if tr_torrentStat() is called again in the same second for a torrent, return the cached value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r4198 r4209  
    714714    tr_stat * s;
    715715    struct tr_tracker * tc;
     716    const time_t now = time( NULL );
     717
     718    /* generating these stats is expensive --
     719     * update a maximum of once per second */
     720    if( tor->lastStatTime == now )
     721        return &tor->stats[tor->statCur];
     722    tor->lastStatTime = now;
    716723
    717724    tr_torrentLock( tor );
Note: See TracChangeset for help on using the changeset viewer.