(trunkn libT) #3192 "crash in most recent nightlies" -- fixed in trunk for 2.00
This commit is contained in:
parent
c7bbd4dc20
commit
fcc56ddcd5
|
@ -616,6 +616,18 @@ publishWarning( tr_tier * tier, const char * msg )
|
|||
publishMessage( tier, msg, TR_TRACKER_WARNING );
|
||||
}
|
||||
|
||||
static int
|
||||
getSeedProbability( int seeds, int leechers )
|
||||
{
|
||||
if( !seeds )
|
||||
return 0;
|
||||
|
||||
if( seeds>=0 && leechers>=0 )
|
||||
return (int)((100.0*seeds)/(seeds+leechers));
|
||||
|
||||
return -1; /* unknown */
|
||||
}
|
||||
|
||||
static int
|
||||
publishNewPeers( tr_tier * tier, int seeds, int leechers,
|
||||
const void * compact, int compactLen )
|
||||
|
@ -623,7 +635,7 @@ publishNewPeers( tr_tier * tier, int seeds, int leechers,
|
|||
tr_tracker_event e = emptyEvent;
|
||||
|
||||
e.messageType = TR_TRACKER_PEERS;
|
||||
e.seedProbability = seeds+leechers ? (int)((100.0*seeds)/(seeds+leechers)) : -1;
|
||||
e.seedProbability = getSeedProbability( seeds, leechers );
|
||||
e.compact = compact;
|
||||
e.compactLen = compactLen;
|
||||
|
||||
|
|
Loading…
Reference in New Issue