Changeset 7109


Ignore:
Timestamp:
Nov 15, 2008, 12:46:51 AM (12 years ago)
Author:
charles
Message:

(libT) some people have complained that Transmission doesn't upload enough until after downloading is complete. This commit ought to fix that.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r7073 r7109  
    18431843    unsigned int    doUnchoke    : 1;
    18441844    unsigned int    isInterested : 1;
    1845     double          rateToClient;
    1846     double          rateToPeer;
     1845    double          rate;
    18471846    tr_peer *       peer;
    18481847};
    1849 
    1850 static int
    1851 tr_compareDouble( double a,
    1852                   double b )
    1853 {
    1854     if( a < b ) return -1;
    1855     if( a > b ) return 1;
    1856     return 0;
    1857 }
    18581848
    18591849static int
     
    18651855    int                      diff = 0;
    18661856
    1867     if( diff == 0 ) /* prefer higher dl speeds */
    1868         diff = -tr_compareDouble( a->rateToClient, b->rateToClient );
    1869     if( diff == 0 ) /* prefer higher ul speeds */
    1870         diff = -tr_compareDouble( a->rateToPeer, b->rateToPeer );
     1857    if( diff == 0 ) /* prefer higher overall speeds */
     1858        diff = a->rate > b->rate ? -1 : 1;
     1859
    18711860    if( diff == 0 ) /* prefer unchoked */
    18721861        diff = (int)a->peer->peerIsChoked - (int)b->peer->peerIsChoked;
     
    19131902            n->peer         = peer;
    19141903            n->isInterested = peer->peerIsInterested;
    1915             n->rateToPeer   = tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER );
    1916             n->rateToClient = tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT );
     1904            n->rate         = tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER )
     1905                            + tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT );
    19171906        }
    19181907    }
Note: See TracChangeset for help on using the changeset viewer.