Changeset 7646


Ignore:
Timestamp:
Jan 9, 2009, 3:45:44 PM (12 years ago)
Author:
charles
Message:

(trunk libT) finally get around to making upload-slots-per-torrent a settings.json option, thanks to friendly prodding from ful in #transmission

Location:
trunk/libtransmission
Files:
4 edited

Legend:

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

    r7626 r7646  
    6767    * this throttle is to avoid overloading the router */
    6868    MAX_CONNECTIONS_PER_SECOND = 32,
    69 
    70     /* number of unchoked peers per torrent.
    71      * FIXME: this probably ought to be configurable */
    72     MAX_UNCHOKED_PEERS = 14,
    7369
    7470    /* number of bad pieces a peer is allowed to send before we ban them */
     
    19331929    tr_peer ** peers = (tr_peer**) tr_ptrArrayBase( &t->peers );
    19341930    struct ChokeData * choke = tr_new0( struct ChokeData, peerCount );
     1931    const tr_session * session = t->manager->session;
    19351932    const int chokeAll = !tr_torrentIsPieceTransferAllowed( t->tor, TR_CLIENT_TO_PEER );
    19361933    const uint64_t now = tr_date( );
     
    19821979     */
    19831980    unchokedInterested = 0;
    1984     for( i=0; i<size && unchokedInterested<MAX_UNCHOKED_PEERS; ++i ) {
     1981    for( i=0; i<size && unchokedInterested<session->uploadSlotsPerTorrent; ++i ) {
    19851982        choke[i].doUnchoke = 1;
    19861983        if( choke[i].isInterested )
  • trunk/libtransmission/session.c

    r7643 r7646  
    254254    tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED,                   100 );
    255255    tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED_ENABLED,           0 );
     256    tr_bencDictAddInt( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, 14 );
    256257}
    257258
     
    298299    tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED,                   tr_sessionGetSpeedLimit( s, TR_UP ) );
    299300    tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED_ENABLED,           tr_sessionIsSpeedLimitEnabled( s, TR_UP ) );
     301    tr_bencDictAddInt( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, s->uploadSlotsPerTorrent );
    300302
    301303    for( i=0; i<n; ++i )
     
    493495    /**
    494496    **/
     497
     498    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, &i );
     499    assert( found );
     500    session->uploadSlotsPerTorrent = i;
    495501 
    496502    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_USPEED, &i )
  • trunk/libtransmission/session.h

    r7643 r7646  
    7777    uint16_t                     openFileLimit;
    7878
     79    int                          uploadSlotsPerTorrent;
     80
    7981    tr_port                      peerPort;
    8082    tr_port                      randomPortLow;
  • trunk/libtransmission/transmission.h

    r7643 r7646  
    156156#define TR_PREFS_KEY_USPEED_ENABLED             "upload-limit-enabled"
    157157#define TR_PREFS_KEY_USPEED                     "upload-limit"
     158#define TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT   "upload-slots-per-torrent"
    158159
    159160struct tr_benc;
Note: See TracChangeset for help on using the changeset viewer.