Changeset 210 for trunk/libtransmission


Ignore:
Timestamp:
Apr 7, 2006, 12:09:08 PM (16 years ago)
Author:
titer
Message:

Adds download rate limit

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer.c

    r133 r210  
    220220    for( ;; )
    221221    {
     222        if( tor && !tr_rcCanTransfer( tor->globalDownload ) )
     223        {
     224            break;
     225        }
     226
    222227        if( peer->size < 1 )
    223228        {
     
    230235            peer->buf   = realloc( peer->buf, peer->size );
    231236        }
     237        /* Never read more than 1K each time, otherwise the rate
     238           control is no use */
    232239        ret = tr_netRecv( peer->socket, &peer->buf[peer->pos],
    233                           peer->size - peer->pos );
     240                          MIN( 1024, peer->size - peer->pos ) );
    234241        if( ret & TR_NET_CLOSE )
    235242        {
  • trunk/libtransmission/transmission.c

    r203 r210  
    138138    tr_rcSetLimit( h->upload, limit );
    139139    tr_chokingSetLimit( h->choking, limit );
     140}
     141
     142/***********************************************************************
     143 * tr_setDownloadLimit
     144 ***********************************************************************
     145 *
     146 **********************************************************************/
     147void tr_setDownloadLimit( tr_handle_t * h, int limit )
     148{
     149    tr_rcSetLimit( h->download, limit );
    140150}
    141151
  • trunk/libtransmission/transmission.h

    r162 r210  
    7575
    7676/***********************************************************************
     77 * tr_setDownloadLimit
     78 ***********************************************************************
     79 * Sets the total download rate limit in KB/s
     80 **********************************************************************/
     81void tr_setDownloadLimit( tr_handle_t *, int );
     82
     83/***********************************************************************
    7784 * tr_torrentCount
    7885 ***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.