Thread: [Filescope-devel] Gnutella2 WebCache remove patch.
Brought to you by:
mzyzik
From: Shervin <She...@sh...> - 2005-02-22 08:32:06
|
This did not get to the mailing list so I am resending it. Hi all This patch resolves the issue of more than one Gnutella2 webcache being deleted in one session. The line causing this problem was (Core/Gnutella2/Sck.cs:391): if(remove || !removedWebCacheToday) It should have been if(remove && !removedWebCacheToday) I also got rid of the remove variable and added HTTP error 410: Gone to the list. This patch is now in CVS. Shervin Index: Sck.cs =================================================================== RCS file: /cvsroot/filescope/filescope/Core/Gnutella2/Sck.cs,v retrieving revision 1.1.1.1 diff -r1.1.1.1 Sck.cs 103a104,106 > // We use this flag to prevent too many webcaches to be removed > static bool removedWebCacheThisSession = false; > 388,391c391,392 < bool remove = false; < if(e.Message.IndexOf("404") != -1 || e.Message.IndexOf("403") != -1) < remove = true; < if(remove || !removedWebCacheToday) --- > > if(e.Message.IndexOf("403") != -1 || e.Message.IndexOf("404") != > -1 || e.Message.IndexOf("410") != -1) 393c394 < lock(Stats.gnutella2WebCache) --- > if(!removedWebCacheThisSession) 395,402c396,406 < for(int posgwc = 0; posgwc < Stats.gnutella2WebCache.Count; posgwc++) < if((string)Stats.gnutella2WebCache[posgwc] == this.address) < { < System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); < Stats.gnutella2WebCache.RemoveAt(posgwc); < removedWebCacheToday = true; < return; < } --- > lock(Stats.gnutella2WebCache) > { > for(int posgwc = 0; posgwc < Stats.gnutella2WebCache.Count; posgwc++) > if((string)Stats.gnutella2WebCache[posgwc] == this.address) > { > System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); > Stats.gnutella2WebCache.RemoveAt(posgwc); > removedWebCacheThisSession = true; > return; > } > } 409,411d412 < //we use this flag to prevent too many webcaches to be removed < static bool removedWebCacheToday = false; < |
From: Shervin <She...@sh...> - 2005-02-22 09:19:11
|
Hi all This patch resolves the issue of more than one Gnutella2 webcache being deleted in one session. The line causing this problem was (Core/Gnutella2/Sck.cs:391): if(remove || !removedWebCacheToday) It should have been if(remove && !removedWebCacheToday) I also got rid of the remove variable and added HTTP error 410: Gone to the list. This patch is now in CVS. Shervin Index: Sck.cs =================================================================== RCS file: /cvsroot/filescope/filescope/Core/Gnutella2/Sck.cs,v retrieving revision 1.1.1.1 diff -r1.1.1.1 Sck.cs 103a104,106 > // We use this flag to prevent too many webcaches to be removed > static bool removedWebCacheThisSession = false; > 388,391c391,392 < bool remove = false; < if(e.Message.IndexOf("404") != -1 || e.Message.IndexOf("403") != -1) < remove = true; < if(remove || !removedWebCacheToday) --- > > if(e.Message.IndexOf("403") != -1 || e.Message.IndexOf("404") != -1 || e.Message.IndexOf("410") != -1) 393c394 < lock(Stats.gnutella2WebCache) --- > if(!removedWebCacheThisSession) 395,402c396,406 < for(int posgwc = 0; posgwc < Stats.gnutella2WebCache.Count; posgwc++) < if((string)Stats.gnutella2WebCache[posgwc] == this.address) < { < System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); < Stats.gnutella2WebCache.RemoveAt(posgwc); < removedWebCacheToday = true; < return; < } --- > lock(Stats.gnutella2WebCache) > { > for(int posgwc = 0; posgwc < Stats.gnutella2WebCache.Count; posgwc++) > if((string)Stats.gnutella2WebCache[posgwc] == this.address) > { > System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); > Stats.gnutella2WebCache.RemoveAt(posgwc); > removedWebCacheThisSession = true; > return; > } > } 409,411d412 < //we use this flag to prevent too many webcaches to be removed < static bool removedWebCacheToday = false; < |
From: Matt Z. <mz...@ny...> - 2005-02-23 03:37:37
|
Shervin, This is not an issue. It was correct before the patch; please revert to the previous instance whenever you can. Look at the code... if it's a 404 error, it HAS to be removed. "if(remove || !removedWebCacheToday)" was correct. --Matt On Mon, Feb 21, 2005 at 08:15:11PM -0800, Shervin wrote: > Hi all > > This patch resolves the issue of more than one Gnutella2 webcache being > deleted in one session. The line causing this problem was > (Core/Gnutella2/Sck.cs:391): > > if(remove || !removedWebCacheToday) > > It should have been > > if(remove && !removedWebCacheToday) > > I also got rid of the remove variable and added HTTP error 410: Gone to the > list. > > This patch is now in CVS. > > Shervin > > > Index: Sck.cs > =================================================================== > RCS file: /cvsroot/filescope/filescope/Core/Gnutella2/Sck.cs,v > retrieving revision 1.1.1.1 > diff -r1.1.1.1 Sck.cs > 103a104,106 > > // We use this flag to prevent too many webcaches to be > removed > > static bool removedWebCacheThisSession = false; > > > 388,391c391,392 > < bool remove = false; > < if(e.Message.IndexOf("404") != -1 || > e.Message.IndexOf("403") != -1) > < remove = true; > < if(remove || !removedWebCacheToday) > --- > > > > if(e.Message.IndexOf("403") != -1 || > e.Message.IndexOf("404") != -1 || e.Message.IndexOf("410") != -1) > 393c394 > < lock(Stats.gnutella2WebCache) > --- > > if(!removedWebCacheThisSession) > 395,402c396,406 > < for(int posgwc = 0; posgwc < > Stats.gnutella2WebCache.Count; posgwc++) > < > if((string)Stats.gnutella2WebCache[posgwc] == this.address) > < { > < > System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); > < > Stats.gnutella2WebCache.RemoveAt(posgwc); > < > removedWebCacheToday = true; > < return; > < } > --- > > > lock(Stats.gnutella2WebCache) > > { > > for(int posgwc = 0; > posgwc < Stats.gnutella2WebCache.Count; posgwc++) > > > if((string)Stats.gnutella2WebCache[posgwc] == this.address) > > { > > > System.Diagnostics.Debug.WriteLine("gwc2 removed: " + this.address); > > > Stats.gnutella2WebCache.RemoveAt(posgwc); > > > removedWebCacheThisSession = true; > > > return; > > } > > } > 409,411d412 > < //we use this flag to prevent too many webcaches to be > removed > < static bool removedWebCacheToday = false; > < > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Filescope-devel mailing list > Fil...@li... > https://lists.sourceforge.net/lists/listinfo/filescope-devel > > |