From 493f5afa6ae2a7002522d4776b8d73d8ce643d7c Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 13 Jun 2010 20:54:03 +0000 Subject: [PATCH] trivial improvement to compareSeedProbabilities() --- libtransmission/peer-mgr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index c5a450c54..a148b11f5 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -3285,10 +3285,12 @@ compareSeedProbabilities( int a, int b ) 2. prefer leechers to unknown 3. prefer unknown to seeds (FIXME: this is a simplistic test) */ if( a == 100 ) a = 101; + else if( a == -1 ) a = 100; + if( b == 100 ) b = 101; - if( a == -1 ) a = 100; - if( b == -1 ) b = 100; - return a - b; + else if( b == -1 ) b = 100; + + return a > b ? 1 : -1; } static tr_bool