support in libT for individual torrent speed caps

This commit is contained in:
Mitchell Livingston 2006-12-27 01:04:30 +00:00
parent cedcbf701e
commit ca2c729abd
2 changed files with 14 additions and 2 deletions

View File

@ -266,7 +266,8 @@ int tr_peerRead( tr_torrent_t * tor, tr_peer_t * peer )
/* Try to read */
for( ;; )
{
if( tor && !tr_rcCanTransfer( tor->globalDownload ) )
if( tor && (!tr_rcCanTransfer( tor->globalDownload )
|| !tr_rcCanTransfer( tor->download ) ) )
{
break;
}
@ -436,7 +437,8 @@ writeBegin:
/* Send pieces if we can */
while( ( p = blockPending( tor, peer, &size ) ) )
{
if( !tr_rcCanTransfer( tor->globalUpload ) )
if( !tr_rcCanTransfer( tor->globalUpload )
|| !tr_rcCanTransfer( tor->upload ) )
{
break;
}

View File

@ -201,6 +201,16 @@ void tr_setGlobalDownloadLimit( tr_handle_t * h, int limit )
tr_rcSetLimit( h->download, limit );
}
void tr_setUploadLimit( tr_torrent_t * tor, int limit )
{
tr_rcSetLimit( tor->upload, limit );
}
void tr_setDownloadLimit( tr_torrent_t * tor, int limit )
{
tr_rcSetLimit( tor->download, limit );
}
void tr_torrentRates( tr_handle_t * h, float * dl, float * ul )
{
tr_torrent_t * tor;