Author: alanmc
Date: 2007-04-01 15:55:12 -0400 (Sun, 01 Apr 2007)
New Revision: 75265

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs
Log:
Implemented some optimisations to improve performance.

Modified: trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs        
2007-04-01 19:18:08 UTC (rev 75264)
+++ trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs        
2007-04-01 19:55:12 UTC (rev 75265)
@@ -282,8 +282,8 @@
                     Array.Copy(this.myBitfield.Array, 0, 
isInterestingBuffer.Array, 0, this.myBitfield.Array.Length);
 
                 isInterestingBuffer.Not();
-                isInterestingBuffer.And(id.Peer.Connection.BitField);
-                if (!isInterestingBuffer.AllFalse)
+                isInterestingBuffer.AndFast(id.Peer.Connection.BitField);
+                if (!isInterestingBuffer.AllFalseSecure())
                     return true;                            // He's 
interesting if he has a piece we want
 
                 lock (this.requests)
@@ -338,11 +338,11 @@
                 if (highestPriorityFound == Priority.DoNotDownload)
                     return null;
 
-                for (int i = 0; i < otherPeers.Count; i++)
+                               for (int i = 0; i < otherPeers.Count; i++)
                 {
                     lock (otherPeers[i])
                     {
-                        if (otherPeers[i].Peer.Connection == null)
+                        if (otherPeers[i].Peer.Connection == null || 
otherPeers[i].Peer.IsSeeder)
                             continue;
 
                         Buffer.BlockCopy(this.bufferBitfield.Array, 0, 
this.previousBitfield.Array, 0, this.bufferBitfield.Array.Length * 4);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to