diff --git a/gtk/tr-core.c b/gtk/tr-core.c index a5348039a..8f53d1a3c 100644 --- a/gtk/tr-core.c +++ b/gtk/tr-core.c @@ -588,6 +588,11 @@ prefsChanged( TrCore * core, const uint16_t val = pref_int_get( key ); tr_sessionSetPeerLimit( tr_core_session( core ), val ); } + else if( !strcmp( key, TR_PREFS_KEY_PEER_LIMIT_TORRENT ) ) + { + const uint16_t val = pref_int_get( key ); + tr_sessionSetPeerLimitPerTorrent( tr_core_session( core ), val ); + } else if( !strcmp( key, PREF_KEY_INHIBIT_HIBERNATION ) ) { maybeInhibitHibernation( core ); diff --git a/libtransmission/session.c b/libtransmission/session.c index b14e87485..a10c309c4 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -710,6 +710,18 @@ tr_sessionGetPeerLimit( const tr_session * session UNUSED ) return tr_fdGetPeerLimit( ); } +void +tr_sessionSetPeerLimitPerTorrent( tr_session * session, uint16_t n ) +{ + session->peerLimitPerTorrent = n; +} + +uint16_t +tr_sessionGetPeerLimitPerTorrent( const tr_session * session ) +{ + return session->peerLimitPerTorrent; +} + /*** **** ***/ diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index c301312f0..f098e29fc 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -538,6 +538,11 @@ void tr_sessionSetPeerLimit( tr_session * session, uint16_t tr_sessionGetPeerLimit( const tr_session * session ); +void tr_sessionSetPeerLimitPerTorrent( tr_session * session, + uint16_t maxGlobalPeers ); + +uint16_t tr_sessionGetPeerLimitPerTorrent( const tr_session * session ); + /** * Load all the torrents in tr_getTorrentDir().