diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 286035b81..8f41f448e 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1206,25 +1206,27 @@ tr_torrentSetFileDLs ( tr_torrent * tor, ***/ void -tr_torrentSetPeerLimits( tr_torrent * tor, - uint16_t maxConnectedPeers, - uint8_t maxUnchokedPeers ) +tr_torrentSetPeerLimit( tr_torrent * tor, + uint16_t maxConnectedPeers ) { - if( maxConnectedPeers ) - tor->maxConnectedPeers = maxConnectedPeers; - if( maxUnchokedPeers ) - tor->maxUnchokedPeers = maxUnchokedPeers; + tor->maxConnectedPeers = maxConnectedPeers; } void -tr_torrentGetPeerLimits( const tr_torrent * tor, - uint16_t * maxConnectedPeers, - uint8_t * maxUnchokedPeers ) +tr_torrentSetPeerUnchokedLimit( tr_torrent * tor, + uint8_t maxUnchokedPeers ) { - if( maxConnectedPeers ) - *maxConnectedPeers = tor->maxConnectedPeers; - if( maxUnchokedPeers ) - *maxUnchokedPeers = tor->maxUnchokedPeers; + tor->maxUnchokedPeers = maxUnchokedPeers; +} + +uint16_t tr_torrentGetPeerLimit( const tr_torrent * tor ) +{ + return tor->maxConnectedPeers; +} + +uint8_t tr_torrentGetPeerUnchokedLimit( const tr_torrent * tor ) +{ + return tor->maxUnchokedPeers; } /*** diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index e61622014..5a1c6e77d 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -278,14 +278,15 @@ void tr_getGlobalSpeedLimit( tr_handle * handle, *** Peer Limits **/ -/* pass `0' to a field here to leave it unchanged */ -void tr_torrentSetPeerLimits( tr_torrent * tor, - uint16_t maxConnectedPeers, +void tr_torrentSetPeerLimit( tr_torrent * tor, + uint16_t maxConnectedPeers); + +void tr_torrentSetPeerUnchokedLimit( tr_torrent * tor, uint8_t maxUnchokedPeers ); -void tr_torrentGetPeerLimits( const tr_torrent * tor, - uint16_t * maxConnectedPeers, - uint8_t * maxUnchokedPeers ); +uint16_t tr_torrentGetPeerLimit( const tr_torrent * tor ); + +uint8_t tr_torrentGetPeerUnchokedLimit( const tr_torrent * tor ); void tr_setGlobalPeerLimit( tr_handle * handle, uint16_t maxGlobalPeers ); diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 519fe3333..e3c59b7a9 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1466,7 +1466,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * fIncompleteFolder = [[fIncompleteFolder stringByExpandingTildeInPath] retain]; } - //set libT settings + //set libtransmission settings for initialization tr_ctor * ctor = tr_ctorNew(fLib); tr_ctorSetPaused(ctor, TR_FORCE, YES);