Changeset 11800


Ignore:
Timestamp:
Jan 31, 2011, 11:35:10 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3959 "by default, disable prefetch for lightweight builds" -- fixed.

User jusid reports prefetch causes load on his NMT to jump from <1 to 3-4. He requests a way to disable prefetch, and suggests that prefetch be disabled by default on lightweight builds. This commit adds a new settings.json key, "prefetch-enabled", which defaults to "true" on standard builds and "false" when compiled with --enable-lightweight.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-msgs.c

    r11782 r11800  
    11961196{
    11971197    int i;
     1198
     1199    if( !getSession(msgs)->isPrefetchEnabled )
     1200        return;
    11981201
    11991202    /* Maintain 12 prefetched blocks per unchoked peer */
  • trunk/libtransmission/session.c

    r11783 r11800  
    5454enum
    5555{
    56     SAVE_INTERVAL_SECS = 360,
    57 
    5856#ifdef TR_LIGHTWEIGHT
    59     DEFAULT_CACHE_SIZE_MB = 2
     57    DEFAULT_CACHE_SIZE_MB = 2,
     58    DEFAULT_PREFETCH_ENABLED = FALSE,
    6059#else
    61     DEFAULT_CACHE_SIZE_MB = 4
     60    DEFAULT_CACHE_SIZE_MB = 4,
     61    DEFAULT_PREFETCH_ENABLED = TRUE,
    6262#endif
     63    SAVE_INTERVAL_SECS = 360
    6364};
    6465
     
    335336    tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING,          TRUE );
    336337    tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION,            TR_PREALLOCATE_SPARSE );
     338    tr_bencDictAddBool( d, TR_PREFS_KEY_PREFETCH_ENABLED,         DEFAULT_PREFETCH_ENABLED );
    337339    tr_bencDictAddReal( d, TR_PREFS_KEY_RATIO,                    2.0 );
    338340    tr_bencDictAddBool( d, TR_PREFS_KEY_RATIO_ENABLED,            FALSE );
     
    399401    tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING,          tr_sessionIsPortForwardingEnabled( s ) );
    400402    tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION,            s->preallocationMode );
     403    tr_bencDictAddInt ( d, TR_PREFS_KEY_PREFETCH_ENABLED,         s->isPrefetchEnabled );
    401404    tr_bencDictAddReal( d, TR_PREFS_KEY_RATIO,                    s->desiredRatio );
    402405    tr_bencDictAddBool( d, TR_PREFS_KEY_RATIO_ENABLED,            s->isRatioLimited );
     
    780783
    781784    /* files and directories */
     785    if( tr_bencDictFindBool( settings, TR_PREFS_KEY_PREFETCH_ENABLED, &boolVal ) )
     786        session->isPrefetchEnabled = boolVal;
    782787    if( tr_bencDictFindInt( settings, TR_PREFS_KEY_PREALLOCATION, &i ) )
    783788        session->preallocationMode = i;
  • trunk/libtransmission/session.h

    r11783 r11800  
    9292    tr_bool                      isLPDEnabled;
    9393    tr_bool                      isBlocklistEnabled;
     94    tr_bool                      isPrefetchEnabled;
    9495    tr_bool                      isTorrentDoneScriptEnabled;
    9596    tr_bool                      isClosed;
  • trunk/libtransmission/transmission.h

    r11756 r11800  
    163163#define TR_PREFS_KEY_DHT_ENABLED                   "dht-enabled"
    164164#define TR_PREFS_KEY_LPD_ENABLED                   "lpd-enabled"
     165#define TR_PREFS_KEY_PREFETCH_ENABLED              "prefetch-enabled"
    165166#define TR_PREFS_KEY_DOWNLOAD_DIR                  "download-dir"
    166167#define TR_PREFS_KEY_ENCRYPTION                    "encryption"
Note: See TracChangeset for help on using the changeset viewer.