[Filescope-devel] Gnutella1 Webcache patch.
Brought to you by:
mzyzik
From: Shervin <She...@sh...> - 2005-02-22 07:32:03
|
Hi all Here is another patch resolving the same issue but on the gnutella1 side. Basically it prevents more than one webcache being removed in one session. This patch is in CVS. Shervin Index: Sck.cs =================================================================== RCS file: /cvsroot/filescope/filescope/Core/Gnutella/Sck.cs,v retrieving revision 1.1.1.1 diff -r1.1.1.1 Sck.cs 93a94,96 > // We use this flag to prevent too many webcaches to be removed > static bool removedWebCacheThisSession = false; > 268c271,274 < if(e.Message.IndexOf("404") != -1 || e.Message.IndexOf("403") != -1 || e.Message.ToLower().IndexOf("error") != -1 || e.Message.ToLower().IndexOf("closed") != -1) --- > System.Diagnostics.Debug.WriteLine("g1 webcache: " + e.Message); > System.Diagnostics.Debug.WriteLine(e.StackTrace); > > if(e.Message.IndexOf("403") != -1 || e.Message.IndexOf("404") != -1 || e.Message.IndexOf("410") != -1) 270c276 < lock(Stats.gnutellaWebCache) --- > if(!removedWebCacheThisSession) 272,279c278,289 < //remove it < for(int posgwc = 0; posgwc < Stats.gnutellaWebCache.Count; posgwc++) < if((string)Stats.gnutellaWebCache[posgwc] == this.address) < { < System.Diagnostics.Debug.WriteLine("gwc removed"); < Stats.gnutellaWebCache.RemoveAt(posgwc); < return; < } --- > lock(Stats.gnutellaWebCache) > { > //remove it > for(int posgwc = 0; posgwc < Stats.gnutellaWebCache.Count; posgwc++) > if((string)Stats.gnutellaWebCache[posgwc] == this.address) > { > System.Diagnostics.Debug.WriteLine("gwc1 removed: " + this.address); > Stats.gnutellaWebCache.RemoveAt(posgwc); > removedWebCacheThisSession = true; > return; > } > } |