Changeset 11307
- Timestamp:
- Oct 13, 2010, 3:56:25 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r11301 r11307 49 49 RECHOKE_PERIOD_MSEC = ( 10 * 1000 ), 50 50 51 /* an optimistically unchoked peer is immune from rechoking 52 for this many calls to rechokeUploads(). */ 53 OPTIMISTIC_UNCHOKE_MULTIPLIER = 4, 54 51 55 /* how frequently to reallocate bandwidth */ 52 56 BANDWIDTH_PERIOD_MSEC = 500, … … 180 184 181 185 tr_torrent * tor; 186 struct tr_peerMgr * manager; 187 182 188 tr_peer * optimistic; /* the optimistic peer, or NULL if none */ 183 struct tr_peerMgr * manager;189 int optimisticUnchokeTimeScaler; 184 190 185 191 tr_bool isRunning; … … 2710 2716 assert( torrentIsLocked( t ) ); 2711 2717 2718 /* an optimistic unchoke peer's "optimistic" 2719 * state lasts for N calls to rechokeUploads(). */ 2720 if( t->optimisticUnchokeTimeScaler > 0 ) 2721 t->optimisticUnchokeTimeScaler--; 2722 else 2723 t->optimistic = NULL; 2724 2712 2725 /* sort the peers by preference and rate */ 2713 2726 for( i = 0, size = 0; i < peerCount; ++i ) … … 2728 2741 tr_peerMsgsSetChoke( peer->msgs, TRUE ); 2729 2742 } 2730 else 2743 else if( peer != t->optimistic ) 2731 2744 { 2732 2745 struct ChokeData * n = &choke[size++]; … … 2765 2778 2766 2779 /* optimistic unchoke */ 2767 if( ! isMaxedOut && (i<size) )2780 if( !t->optimistic && !isMaxedOut && (i<size) ) 2768 2781 { 2769 2782 int n; … … 2788 2801 c->isChoked = FALSE; 2789 2802 t->optimistic = c->peer; 2803 t->optimisticUnchokeTimeScaler = OPTIMISTIC_UNCHOKE_MULTIPLIER; 2790 2804 } 2791 2805
Note: See TracChangeset
for help on using the changeset viewer.