Re: [core-dev] PATCH: ManagedDownloader bug

Sumeet Thadani <[email protected]> Mon, 07 Jun 2004 10:33:24 -0400
Newsgroups gmane.network.gnutella.limewire.core.devel
Message-ID <[email protected]>
Thanks Gregorio. I will take a look.

-Sumeet

Gregorio Roper wrote:

> This patch contains a small fix: LimeWire wasn't remembering bad 
> alternate locations as it
> is supposed to and would retry them over and over again. It also adds 
> a small check so
> LimeWire doesn't try to send pushes for alt-locs.
>
> mfg
> gregorio
>
>------------------------------------------------------------------------
>
>Index: ManagedDownloader.java
>===================================================================
>RCS file: /cvs/core/com/limegroup/gnutella/downloader/ManagedDownloader.java,v
>retrieving revision 1.262
>diff -u -r1.262 ManagedDownloader.java
>--- ManagedDownloader.java	30 May 2004 23:57:57 -0000	1.262
>+++ ManagedDownloader.java	7 Jun 2004 10:56:15 -0000
>@@ -1238,8 +1238,8 @@
>             }
>         }
> 
>-        if(good) {
>-            synchronized(altLock) {
>+        synchronized(altLock) {
>+            if(good) {
>                 //check if validAlts contains loc to avoid duplicate stats, and
>                 //spurious count increments in the local
>                 //AlternateLocationCollections
>@@ -1249,7 +1249,8 @@
>                     validAlts.add(loc);
>                     if( ifd != null )
>                         ifd.addVerified(forFD);
>-                }  else {
>+                }
>+            }  else {
>                     if( RECORD_STATS && rfd.isFromAlternateLocation() )
>                         DownloadStat.ALTERNATE_NOT_ADDED.incrementStat();
>                     validAlts.remove(loc);
>@@ -1257,9 +1258,8 @@
>                         ifd.remove(forFD);
>                     invalidAlts.add(rfd.getRemoteHostData());
>                     recentInvalidAlts.add(loc);
>-                }
>             }
>-        }
>+        } 
>     }
> 
>     public boolean resume() throws AlreadyDownloadingException {
>@@ -2628,13 +2628,15 @@
>         // must notify that we cannot connect directly.
>         informMesh(rfd, false);
> 
>-        try {
>-            ret = connectWithPush(rfd, incFile);
>-            return ret;
>-        } catch(IOException e) {
>-            // even the push failed :(
>+        if (!rfd.isFromAlternateLocation()) {
>+            try {
>+                 ret = connectWithPush(rfd, incFile);
>+                 return ret;
>+            } catch(IOException e) {
>+                // even the push failed :(
>+            }
>         }
>-
>+        
>         // if we're here, everything failed.
>         return null;
>     }
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>core-dev mailing list
>[email protected]
>http://www.limewire.org/mailman/listinfo/core-dev
>  
>


_______________________________________________
core-dev mailing list
[email protected]
http://www.limewire.org/mailman/listinfo/core-dev