Changeset 8709
- Timestamp:
- Jun 16, 2009, 7:31:17 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bandwidth.h
r8693 r8709 17 17 #ifndef TR_BANDWIDTH_H 18 18 #define TR_BANDWIDTH_H 19 20 #include <assert.h>21 19 22 20 #include "transmission.h" … … 155 153 */ 156 154 static TR_INLINE void tr_bandwidthSetDesiredSpeed( tr_bandwidth * bandwidth, 157 158 155 tr_direction dir, 156 double desiredSpeed ) 159 157 { 160 158 bandwidth->band[dir].desiredSpeed = desiredSpeed; … … 241 239 * in that particular case we want to ignore the global speed limit... 242 240 */ 243 static TR_INLINE void 244 tr_bandwidthHonorParentLimits( tr_bandwidth * bandwidth, 245 tr_direction direction, 246 tr_bool isEnabled ) 241 static TR_INLINE void tr_bandwidthHonorParentLimits ( tr_bandwidth * bandwidth, 242 tr_direction direction, 243 tr_bool isEnabled ) 247 244 { 248 245 assert( tr_isBandwidth( bandwidth ) ); … … 252 249 } 253 250 254 static TR_INLINE tr_bool 255 tr_bandwidthAreParentLimitsHonored( const tr_bandwidth * bandwidth, 256 tr_direction direction ) 251 static TR_INLINE tr_bool tr_bandwidthAreParentLimitsHonored( tr_bandwidth * bandwidth, 252 tr_direction direction ) 257 253 { 258 254 assert( tr_isBandwidth( bandwidth ) ); -
trunk/libtransmission/peer-mgr.c
r8693 r8709 1315 1315 peer->io = tr_handshakeStealIO( handshake ); /* this steals its refcount too, which is 1316 1316 balanced by our unref in peerDestructor() */ 1317 tr_peerIoSetParent( peer->io, &t->tor->bandwidth );1317 tr_peerIoSetParent( peer->io, t->tor->bandwidth ); 1318 1318 tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag ); 1319 1319 -
trunk/libtransmission/torrent.c
r8693 r8709 115 115 assert( tr_isDirection( dir ) ); 116 116 117 tr_bandwidthSetDesiredSpeed( &tor->bandwidth, dir, KiB_sec );117 tr_bandwidthSetDesiredSpeed( tor->bandwidth, dir, KiB_sec ); 118 118 } 119 119 … … 124 124 assert( tr_isDirection( dir ) ); 125 125 126 return tr_bandwidthGetDesiredSpeed( &tor->bandwidth, dir );126 return tr_bandwidthGetDesiredSpeed( tor->bandwidth, dir ); 127 127 } 128 128 … … 133 133 assert( tr_isDirection( dir ) ); 134 134 135 tr_bandwidthSetLimited( &tor->bandwidth, dir, do_use );135 tr_bandwidthSetLimited( tor->bandwidth, dir, do_use ); 136 136 } 137 137 … … 142 142 assert( tr_isDirection( dir ) ); 143 143 144 return tr_bandwidthIsLimited( &tor->bandwidth, dir );144 return tr_bandwidthIsLimited( tor->bandwidth, dir ); 145 145 } 146 146 … … 150 150 assert( tr_isTorrent( tor ) ); 151 151 152 tr_bandwidthHonorParentLimits( &tor->bandwidth, TR_UP, doUse );153 tr_bandwidthHonorParentLimits( &tor->bandwidth, TR_DOWN, doUse );152 tr_bandwidthHonorParentLimits( tor->bandwidth, TR_UP, doUse ); 153 tr_bandwidthHonorParentLimits( tor->bandwidth, TR_DOWN, doUse ); 154 154 } 155 155 … … 159 159 assert( tr_isTorrent( tor ) ); 160 160 161 return tr_bandwidthAreParentLimitsHonored( &tor->bandwidth, TR_UP );161 return tr_bandwidthAreParentLimitsHonored( tor->bandwidth, TR_UP ); 162 162 } 163 163 … … 543 543 randomizeTiers( info ); 544 544 545 t r_bandwidthConstruct( &tor->bandwidth,session, session->bandwidth );545 tor->bandwidth = tr_bandwidthNew( session, session->bandwidth ); 546 546 547 547 tor->blockSize = getBlockSize( info->pieceSize ); … … 886 886 d = tr_peerMgrGetWebseedSpeed( tor, now ); 887 887 s->swarmSpeed = tr_rcRate( &tor->swarmSpeed, now ); 888 s->rawUploadSpeed = tr_bandwidthGetRawSpeed ( &tor->bandwidth, now, TR_UP );889 s->pieceUploadSpeed = tr_bandwidthGetPieceSpeed( &tor->bandwidth, now, TR_UP );890 s->rawDownloadSpeed = d + tr_bandwidthGetRawSpeed ( &tor->bandwidth, now, TR_DOWN );891 s->pieceDownloadSpeed = d + tr_bandwidthGetPieceSpeed( &tor->bandwidth, now, TR_DOWN );888 s->rawUploadSpeed = tr_bandwidthGetRawSpeed ( tor->bandwidth, now, TR_UP ); 889 s->pieceUploadSpeed = tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_UP ); 890 s->rawDownloadSpeed = d + tr_bandwidthGetRawSpeed ( tor->bandwidth, now, TR_DOWN ); 891 s->pieceDownloadSpeed = d + tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_DOWN ); 892 892 893 893 usableSeeds += tor->info.webseedCount; … … 1211 1211 session->torrentCount--; 1212 1212 1213 tr_bandwidth Destruct( &tor->bandwidth );1213 tr_bandwidthFree( tor->bandwidth ); 1214 1214 1215 1215 tr_metainfoFree( inf ); … … 1740 1740 assert( tr_isTorrent( tor ) ); 1741 1741 1742 return tor->bandwidth .priority;1742 return tor->bandwidth->priority; 1743 1743 } 1744 1744 … … 1749 1749 assert( tr_isPriority( priority ) ); 1750 1750 1751 tor->bandwidth .priority = priority;1751 tor->bandwidth->priority = priority; 1752 1752 } 1753 1753 -
trunk/libtransmission/torrent.h
r8693 r8709 18 18 #define TR_TORRENT_H 1 19 19 20 #include "bandwidth.h" /* tr_bandwidth */21 20 #include "completion.h" /* tr_completion */ 22 21 #include "ratecontrol.h" /* tr_ratecontrol */ … … 174 173 tr_completeness completeness; 175 174 176 struct tr_bandwidth bandwidth;177 178 175 struct tr_tracker * tracker; 179 176 struct tr_publisher_tag * trackerSubscription; … … 217 214 int uniqueId; 218 215 216 struct tr_bandwidth * bandwidth; 217 219 218 struct tr_torrent_peers * torrentPeers; 220 219
Note: See TracChangeset
for help on using the changeset viewer.