Author: alanmc
Date: 2007-04-02 17:06:35 -0400 (Mon, 02 Apr 2007)
New Revision: 75309

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs
Log:
Correctly picking pieces in situations where there is only 1 connected peer 
with the new fastpaths

Modified: trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs        
2007-04-02 21:03:05 UTC (rev 75308)
+++ trunk/bitsharp/src/MonoTorrent.Client/PiecePicking/StandardPicker.cs        
2007-04-02 21:06:35 UTC (rev 75309)
@@ -327,8 +327,12 @@
                 // Now we see what pieces the peer has that we don't have and 
try and request one
                 Buffer.BlockCopy(this.myBitfield.Array, 0, 
bufferBitfield.Array, 0, this.bufferBitfield.Array.Length * 4);
                 this.bufferBitfield.Not();
-                this.bufferBitfield.AndFast(id.Peer.Connection.BitField);
 
+                if(!id.Peer.IsSeeder)
+                    this.bufferBitfield.AndFast(id.Peer.Connection.BitField);
+
+                Buffer.BlockCopy(this.bufferBitfield.Array, 0, 
this.previousBitfield.Array, 0, this.bufferBitfield.Array.Length * 4);
+
                 // Out of the pieces the other peer has that we want, we look 
for the highest priority and store it here.
                 // We then keep NANDing the bitfield until we no longer have 
pieces with that priority. Then we can pick
                 // a piece from the "highest priority" available

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

Reply via email to