Author: toad
Date: 2008-12-09 14:53:21 +0000 (Tue, 09 Dec 2008)
New Revision: 24138

Modified:
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
When an old-opennet-peer reconnects, add it at the top of the LRU, not the 
bottom. Explain why.


Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-12-09 
14:11:33 UTC (rev 24137)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-12-09 
14:53:21 UTC (rev 24138)
@@ -1201,7 +1201,11 @@
                                Logger.normal(this, "Dumping incoming 
old-opennet peer as opennet just turned off: "+pn+".");
                                return;
                        }
-                       if(!opennet.wantPeer(pn, true, false, true)) {
+                       /* When an old-opennet-peer connects, add it at the top 
of the LRU, so that it isn't
+                        * immediately dropped when there is no droppable peer 
to drop. If it was dropped 
+                        * from the bottom of the LRU list, we would not have 
added it to the LRU; so it was
+                        * somewhere in the middle. */
+                       if(!opennet.wantPeer(pn, false, false, true)) {
                                Logger.normal(this, "No longer want peer "+pn+" 
- dumping it after connecting");
                                dontWant = true;
                                opennet.purgeOldOpennetPeer(pn);
@@ -1418,7 +1422,11 @@
                                Logger.normal(this, "Dumping incoming 
old-opennet peer as opennet just turned off: "+pn+".");
                                return true;
                        }
-                       if(!opennet.wantPeer(pn, true, false, true)) {
+                       /* When an old-opennet-peer connects, add it at the top 
of the LRU, so that it isn't
+                        * immediately dropped when there is no droppable peer 
to drop. If it was dropped 
+                        * from the bottom of the LRU list, we would not have 
added it to the LRU; so it was
+                        * somewhere in the middle. */
+                       if(!opennet.wantPeer(pn, false, false, true)) {
                                Logger.normal(this, "No longer want peer "+pn+" 
- dumping it after connecting");
                                dontWant = true;
                                opennet.purgeOldOpennetPeer(pn);

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to