Changeset 7110


Ignore:
Timestamp:
Nov 15, 2008, 1:07:08 AM (12 years ago)
Author:
charles
Message:

(libT) fix r7109 oops spotted by BentMyWookie?

File:
1 edited

Legend:

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

    r7109 r7110  
    18431843    unsigned int    doUnchoke    : 1;
    18441844    unsigned int    isInterested : 1;
    1845     double          rate;
     1845    unsigned int    isChoked     : 1;
     1846    int             rate;
    18461847    tr_peer *       peer;
    18471848};
     
    18531854    const struct ChokeData * a = va;
    18541855    const struct ChokeData * b = vb;
    1855     int                      diff = 0;
    1856 
    1857     if( diff == 0 ) /* prefer higher overall speeds */
    1858         diff = a->rate > b->rate ? -1 : 1;
    1859 
    1860     if( diff == 0 ) /* prefer unchoked */
    1861         diff = (int)a->peer->peerIsChoked - (int)b->peer->peerIsChoked;
    1862 
    1863     return diff;
     1856
     1857    if( a->rate != b->rate ) /* prefer higher overall speeds */
     1858        return a->rate > b->rate ? -1 : 1;
     1859
     1860    if( a->isChoked != b->isChoked ) /* prefer unchoked */
     1861        return a->isChoked ? 1 : -1;
     1862
     1863    return 0;
    18641864}
    18651865
     
    19021902            n->peer         = peer;
    19031903            n->isInterested = peer->peerIsInterested;
    1904             n->rate         = tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER )
    1905                             + tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT );
     1904            n->isChoked     = peer->peerIsChoked;
     1905            n->rate = (int)(tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER )
     1906                            + tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT ) );
    19061907        }
    19071908    }
Note: See TracChangeset for help on using the changeset viewer.