Author: alanmc
Date: 2007-04-02 20:12:15 -0400 (Mon, 02 Apr 2007)
New Revision: 75319

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/Managers/TorrentManager.cs
Log:
BugFix: Removed the slightly infinite loop for when we are downloading faster 
than the disk can write.

Modified: trunk/bitsharp/src/MonoTorrent.Client/Managers/TorrentManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/Managers/TorrentManager.cs    
2007-04-02 23:38:15 UTC (rev 75318)
+++ trunk/bitsharp/src/MonoTorrent.Client/Managers/TorrentManager.cs    
2007-04-03 00:12:15 UTC (rev 75319)
@@ -651,14 +651,15 @@
             if (this.state == TorrentState.Paused)
                 return;
 
-            // While there are peers queued in the list and i haven't used my 
download allowance, resume downloading
-            // from that peer. Don't resume if there are more than 20 queued 
writes in the download queue.
-            while (this.peers.DownloadQueue.Count > 0 && 
((this.rateLimiter.DownloadChunks > 0) || this.settings.MaxDownloadSpeed == 0))
-                if (this.fileManager.QueuedWrites < 20)
+        // While there are peers queued in the list and i haven't used my 
download allowance, resume downloading
+        // from that peer. Don't resume if there are more than 20 queued 
writes in the download queue.
+        while (this.peers.DownloadQueue.Count > 0 &&
+                this.fileManager.QueuedWrites < 20 &&
+                ((this.rateLimiter.DownloadChunks > 0) || 
this.settings.MaxDownloadSpeed == 0))
                     if 
(ClientEngine.ConnectionManager.ResumePeer(this.peers.Dequeue(PeerType.DownloadQueue),
 true) > ConnectionManager.ChunkLength / 2.0)
                         Interlocked.Decrement(ref 
this.rateLimiter.DownloadChunks);
 
-            while (this.peers.UploadQueue.Count > 0 && 
((this.rateLimiter.UploadChunks > 0) || this.settings.MaxUploadSpeed == 0))
+           while (this.peers.UploadQueue.Count > 0 && 
((this.rateLimiter.UploadChunks > 0) || this.settings.MaxUploadSpeed == 0))
                 if 
(ClientEngine.ConnectionManager.ResumePeer(this.peers.Dequeue(PeerType.UploadQueue),
 false) > ConnectionManager.ChunkLength / 2.0)
                     Interlocked.Decrement(ref this.rateLimiter.UploadChunks);
         }

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

Reply via email to