mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
(trunk libT) revert most of r8693 as a quick fix for a possible alignment issue on a NAS
This commit is contained in:
parent
2b63e5d89e
commit
683073855e
4 changed files with 25 additions and 30 deletions
|
@ -17,8 +17,6 @@
|
|||
#ifndef TR_BANDWIDTH_H
|
||||
#define TR_BANDWIDTH_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "ptrarray.h"
|
||||
#include "utils.h" /* tr_new(), tr_free() */
|
||||
|
@ -154,8 +152,8 @@ static TR_INLINE tr_bool tr_isBandwidth( const tr_bandwidth * b )
|
|||
* @see tr_bandwidthGetDesiredSpeed
|
||||
*/
|
||||
static TR_INLINE void tr_bandwidthSetDesiredSpeed( tr_bandwidth * bandwidth,
|
||||
tr_direction dir,
|
||||
double desiredSpeed )
|
||||
tr_direction dir,
|
||||
double desiredSpeed )
|
||||
{
|
||||
bandwidth->band[dir].desiredSpeed = desiredSpeed;
|
||||
}
|
||||
|
@ -240,10 +238,9 @@ void tr_bandwidthSetParent ( tr_bandwidth * bandwidth,
|
|||
* But when we set a torrent's speed mode to TR_SPEEDLIMIT_UNLIMITED, then
|
||||
* in that particular case we want to ignore the global speed limit...
|
||||
*/
|
||||
static TR_INLINE void
|
||||
tr_bandwidthHonorParentLimits( tr_bandwidth * bandwidth,
|
||||
tr_direction direction,
|
||||
tr_bool isEnabled )
|
||||
static TR_INLINE void tr_bandwidthHonorParentLimits ( tr_bandwidth * bandwidth,
|
||||
tr_direction direction,
|
||||
tr_bool isEnabled )
|
||||
{
|
||||
assert( tr_isBandwidth( bandwidth ) );
|
||||
assert( tr_isDirection( direction ) );
|
||||
|
@ -251,9 +248,8 @@ tr_bandwidthHonorParentLimits( tr_bandwidth * bandwidth,
|
|||
bandwidth->band[direction].honorParentLimits = isEnabled;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
tr_bandwidthAreParentLimitsHonored( const tr_bandwidth * bandwidth,
|
||||
tr_direction direction )
|
||||
static TR_INLINE tr_bool tr_bandwidthAreParentLimitsHonored( tr_bandwidth * bandwidth,
|
||||
tr_direction direction )
|
||||
{
|
||||
assert( tr_isBandwidth( bandwidth ) );
|
||||
assert( tr_isDirection( direction ) );
|
||||
|
|
|
@ -1314,7 +1314,7 @@ myHandshakeDoneCB( tr_handshake * handshake,
|
|||
peer->atom = atom;
|
||||
peer->io = tr_handshakeStealIO( handshake ); /* this steals its refcount too, which is
|
||||
balanced by our unref in peerDestructor() */
|
||||
tr_peerIoSetParent( peer->io, &t->tor->bandwidth );
|
||||
tr_peerIoSetParent( peer->io, t->tor->bandwidth );
|
||||
tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag );
|
||||
|
||||
success = TRUE;
|
||||
|
|
|
@ -114,7 +114,7 @@ tr_torrentSetSpeedLimit( tr_torrent * tor, tr_direction dir, int KiB_sec )
|
|||
assert( tr_isTorrent( tor ) );
|
||||
assert( tr_isDirection( dir ) );
|
||||
|
||||
tr_bandwidthSetDesiredSpeed( &tor->bandwidth, dir, KiB_sec );
|
||||
tr_bandwidthSetDesiredSpeed( tor->bandwidth, dir, KiB_sec );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -123,7 +123,7 @@ tr_torrentGetSpeedLimit( const tr_torrent * tor, tr_direction dir )
|
|||
assert( tr_isTorrent( tor ) );
|
||||
assert( tr_isDirection( dir ) );
|
||||
|
||||
return tr_bandwidthGetDesiredSpeed( &tor->bandwidth, dir );
|
||||
return tr_bandwidthGetDesiredSpeed( tor->bandwidth, dir );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -132,7 +132,7 @@ tr_torrentUseSpeedLimit( tr_torrent * tor, tr_direction dir, tr_bool do_use )
|
|||
assert( tr_isTorrent( tor ) );
|
||||
assert( tr_isDirection( dir ) );
|
||||
|
||||
tr_bandwidthSetLimited( &tor->bandwidth, dir, do_use );
|
||||
tr_bandwidthSetLimited( tor->bandwidth, dir, do_use );
|
||||
}
|
||||
|
||||
tr_bool
|
||||
|
@ -141,7 +141,7 @@ tr_torrentUsesSpeedLimit( const tr_torrent * tor, tr_direction dir )
|
|||
assert( tr_isTorrent( tor ) );
|
||||
assert( tr_isDirection( dir ) );
|
||||
|
||||
return tr_bandwidthIsLimited( &tor->bandwidth, dir );
|
||||
return tr_bandwidthIsLimited( tor->bandwidth, dir );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -149,8 +149,8 @@ tr_torrentUseSessionLimits( tr_torrent * tor, tr_bool doUse )
|
|||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
tr_bandwidthHonorParentLimits( &tor->bandwidth, TR_UP, doUse );
|
||||
tr_bandwidthHonorParentLimits( &tor->bandwidth, TR_DOWN, doUse );
|
||||
tr_bandwidthHonorParentLimits( tor->bandwidth, TR_UP, doUse );
|
||||
tr_bandwidthHonorParentLimits( tor->bandwidth, TR_DOWN, doUse );
|
||||
}
|
||||
|
||||
tr_bool
|
||||
|
@ -158,7 +158,7 @@ tr_torrentUsesSessionLimits( const tr_torrent * tor )
|
|||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
return tr_bandwidthAreParentLimitsHonored( &tor->bandwidth, TR_UP );
|
||||
return tr_bandwidthAreParentLimitsHonored( tor->bandwidth, TR_UP );
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -542,7 +542,7 @@ torrentRealInit( tr_torrent * tor, const tr_ctor * ctor )
|
|||
|
||||
randomizeTiers( info );
|
||||
|
||||
tr_bandwidthConstruct( &tor->bandwidth, session, session->bandwidth );
|
||||
tor->bandwidth = tr_bandwidthNew( session, session->bandwidth );
|
||||
|
||||
tor->blockSize = getBlockSize( info->pieceSize );
|
||||
|
||||
|
@ -885,10 +885,10 @@ tr_torrentStat( tr_torrent * tor )
|
|||
now = tr_date( );
|
||||
d = tr_peerMgrGetWebseedSpeed( tor, now );
|
||||
s->swarmSpeed = tr_rcRate( &tor->swarmSpeed, now );
|
||||
s->rawUploadSpeed = tr_bandwidthGetRawSpeed ( &tor->bandwidth, now, TR_UP );
|
||||
s->pieceUploadSpeed = tr_bandwidthGetPieceSpeed( &tor->bandwidth, now, TR_UP );
|
||||
s->rawDownloadSpeed = d + tr_bandwidthGetRawSpeed ( &tor->bandwidth, now, TR_DOWN );
|
||||
s->pieceDownloadSpeed = d + tr_bandwidthGetPieceSpeed( &tor->bandwidth, now, TR_DOWN );
|
||||
s->rawUploadSpeed = tr_bandwidthGetRawSpeed ( tor->bandwidth, now, TR_UP );
|
||||
s->pieceUploadSpeed = tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_UP );
|
||||
s->rawDownloadSpeed = d + tr_bandwidthGetRawSpeed ( tor->bandwidth, now, TR_DOWN );
|
||||
s->pieceDownloadSpeed = d + tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_DOWN );
|
||||
|
||||
usableSeeds += tor->info.webseedCount;
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ freeTorrent( tr_torrent * tor )
|
|||
assert( session->torrentCount >= 1 );
|
||||
session->torrentCount--;
|
||||
|
||||
tr_bandwidthDestruct( &tor->bandwidth );
|
||||
tr_bandwidthFree( tor->bandwidth );
|
||||
|
||||
tr_metainfoFree( inf );
|
||||
tr_free( tor );
|
||||
|
@ -1739,7 +1739,7 @@ tr_torrentGetPriority( const tr_torrent * tor )
|
|||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
return tor->bandwidth.priority;
|
||||
return tor->bandwidth->priority;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1748,7 +1748,7 @@ tr_torrentSetPriority( tr_torrent * tor, tr_priority_t priority )
|
|||
assert( tr_isTorrent( tor ) );
|
||||
assert( tr_isPriority( priority ) );
|
||||
|
||||
tor->bandwidth.priority = priority;
|
||||
tor->bandwidth->priority = priority;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#ifndef TR_TORRENT_H
|
||||
#define TR_TORRENT_H 1
|
||||
|
||||
#include "bandwidth.h" /* tr_bandwidth */
|
||||
#include "completion.h" /* tr_completion */
|
||||
#include "ratecontrol.h" /* tr_ratecontrol */
|
||||
#include "session.h" /* tr_globalLock(), tr_globalUnlock() */
|
||||
|
@ -173,8 +172,6 @@ struct tr_torrent
|
|||
struct tr_bitfield checkedPieces;
|
||||
tr_completeness completeness;
|
||||
|
||||
struct tr_bandwidth bandwidth;
|
||||
|
||||
struct tr_tracker * tracker;
|
||||
struct tr_publisher_tag * trackerSubscription;
|
||||
|
||||
|
@ -216,6 +213,8 @@ struct tr_torrent
|
|||
|
||||
int uniqueId;
|
||||
|
||||
struct tr_bandwidth * bandwidth;
|
||||
|
||||
struct tr_torrent_peers * torrentPeers;
|
||||
|
||||
double desiredRatio;
|
||||
|
|
Loading…
Reference in a new issue