[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/network/ktorrent/libbtcore
From:       Joris Guisson <joris.guisson () gmail ! com>
Date:       2009-05-11 7:02:58
Message-ID: 1242025378.864151.29085.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 966376 by guisson:

Tweak choke algorithm a bit and remove unused evil flag

 M  +0 -3      interfaces/peerinterface.h  
 M  +0 -4      peer/peer.cpp  
 M  +1 -7      torrent/advancedchokealgorithm.cpp  


--- trunk/extragear/network/ktorrent/libbtcore/interfaces/peerinterface.h #966375:966376
@@ -63,9 +63,6 @@
 			bt::Uint64 bytes_downloaded;
 			/// Advanced choke algorithm score
 			double aca_score;
-			/// The evil flag is on when the peer has not choked us, 
-			/// but has snubbed us and requests have timedout
-			bool evil;
 			/// Flag to indicate if this peer has an upload slot
 			bool has_upload_slot;
 			/// Is the peer interested
--- trunk/extragear/network/ktorrent/libbtcore/peer/peer.cpp #966375:966376
@@ -85,7 +85,6 @@
 		stats.extension_protocol = support & EXT_PROT_SUPPORT;
 		stats.bytes_downloaded = stats.bytes_uploaded = 0;
 		stats.aca_score = 0.0;
-		stats.evil = false;
 		stats.has_upload_slot = false;
 		stats.num_up_requests = stats.num_down_requests = 0;
 		stats.encrypted = sock->encrypted();
@@ -259,9 +258,6 @@
 				
 				{
 					stats.bytes_downloaded += (len - 9);
-					// turn on evil bit
-					if (stats.evil)
-						stats.evil = false;
 					Piece p(ReadUint32(tmp_buf,1),
 							ReadUint32(tmp_buf,5),
 							len - 9,downloader,tmp_buf+9);
--- trunk/extragear/network/ktorrent/libbtcore/torrent/advancedchokealgorithm.cpp #966375:966376
@@ -89,7 +89,7 @@
 		
 		double nb = 0.0; // newbie bonus
 		double cp = 0.0; // choke penalty
-		double sp = 0.0; // snubbing penalty
+		double sp = s.snubbed ? SNUB_PENALTY : 0.0; // snubbing penalty
 		double lb = s.local ? 10.0 : 0.0; // local peers get a bonus of 10
 		double bd = s.bytes_downloaded; // bytes downloaded
 		double tbd = stats.session_bytes_downloaded; // total bytes downloaded
@@ -107,12 +107,6 @@
 			cp = NEWBIE_BONUS; // cp cancels out newbie bonus
 		}
 		
-		// if the evil bit is on (!choked, snubbed and requests have timed out)
-		if (s.evil)
-		{
-			sp = SNUB_PENALTY;
-		}
-		
 		// NB + K * (BD/TBD) - CP - SP + L * (DS / TDS)
 		double K = 5.0;
 		double L = 5.0;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic