Changeset 10654


Ignore:
Timestamp:
May 18, 2010, 3:14:54 PM (11 years ago)
Author:
charles
Message:

(trunkn libT) #3192 "crash in most recent nightlies" -- fixed in trunk for 2.00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r10652 r10654  
    618618
    619619static int
     620getSeedProbability( int seeds, int leechers )
     621{
     622    if( !seeds )
     623        return 0;
     624
     625    if( seeds>=0 && leechers>=0 )
     626        return (int)((100.0*seeds)/(seeds+leechers));
     627
     628    return -1; /* unknown */
     629}
     630
     631static int
    620632publishNewPeers( tr_tier * tier, int seeds, int leechers,
    621633                 const void * compact, int compactLen )
     
    624636
    625637    e.messageType = TR_TRACKER_PEERS;
    626     e.seedProbability = seeds+leechers ? (int)((100.0*seeds)/(seeds+leechers)) : -1;
     638    e.seedProbability = getSeedProbability( seeds, leechers );
    627639    e.compact = compact;
    628640    e.compactLen = compactLen;
Note: See TracChangeset for help on using the changeset viewer.