On Fri, Dec 5, 2008 at 9:42 PM, <toad at freenetproject.org> wrote:
> Author: toad
> Date: 2008-12-05 13:42:13 +0000 (Fri, 05 Dec 2008)
> New Revision: 24063
>
> Modified:
> trunk/freenet/src/freenet/node/FNPPacketMangler.java
> trunk/freenet/src/freenet/node/OpennetManager.java
> trunk/freenet/src/freenet/node/RequestHandler.java
> Log:
> We were sending offers very infrequently because every time we had an
> unmatchable packet that might be from an old-opennet-peer, we would treat the
> decision as to whether to process it as sending an offer! This also meant
> that we hardly ever process any old-opennet-peer packets...
>
>
> Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/FNPPacketMangler.java 2008-12-05
> 09:31:18 UTC (rev 24062)
> +++ trunk/freenet/src/freenet/node/FNPPacketMangler.java 2008-12-05
> 13:42:13 UTC (rev 24063)
> @@ -303,7 +303,7 @@
> OpennetManager opennet = node.getOpennet();
> if(opennet != null) {
> // Try old opennet connections.
> - if(opennet.wantPeer(null, false)) {
> + if(opennet.wantPeer(null, false, true)) {
> // We want a peer.
> // Try old connections.
> PeerNode[] oldPeers = opennet.getOldPeers();
> @@ -1189,7 +1189,7 @@
> Logger.normal(this, "Dumping incoming
> old-opennet peer as opennet just turned off: "+pn+".");
> return;
> }
> - if(!opennet.wantPeer(pn, true)) {
> + if(!opennet.wantPeer(pn, true, false)) {
> Logger.normal(this, "No longer want peer
> "+pn+" - dumping it after connecting");
> dontWant = true;
> }
> @@ -1382,7 +1382,7 @@
> Logger.normal(this, "Dumping incoming
> old-opennet peer as opennet just turned off: "+pn+".");
> return true;
> }
> - if(!opennet.wantPeer(pn, true)) {
> + if(!opennet.wantPeer(pn, true, false)) {
> Logger.normal(this, "No longer want peer
> "+pn+" - dumping it after connecting");
> dontWant = true;
> }
>
> Modified: trunk/freenet/src/freenet/node/OpennetManager.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/OpennetManager.java 2008-12-05 09:31:18
> UTC (rev 24062)
> +++ trunk/freenet/src/freenet/node/OpennetManager.java 2008-12-05 13:42:13
> UTC (rev 24063)
> @@ -246,7 +246,7 @@
> if(logMINOR) Logger.minor(this, "Not adding
> "+pn.userToString()+" to opennet list as already there");
> return null;
> }
> - if(wantPeer(pn, true)) return pn;
> + if(wantPeer(pn, true, false)) return pn;
> else return null;
> // Start at bottom. Node must prove itself.
> }
> @@ -273,9 +273,11 @@
> * @param addAtLRU If there is a node to add, add it at the bottom
> rather than the top. Normally
> * we set this on new path folded nodes so that they will be replaced
> if during the trial period,
> * plus the time it takes to get a new path folding offer, they don't
> have a successful request.
> + * @param notSendingOffer If true, and nodeToAddNow == null, we don't
> actually send an offer, we
> + * just want to know if there is space for a node.
> * @return True if the node was added / should be added.
> */
> - public boolean wantPeer(PeerNode nodeToAddNow, boolean addAtLRU) {
> + public boolean wantPeer(PeerNode nodeToAddNow, boolean addAtLRU,
> boolean notSendingOffer) {
A negative boolean field make my head explode..
...."when not sending offer is false, it is not not sending offer ...."
Name it "checkEmptySlotOnly" or something?
> boolean notMany = false;
> boolean noDisconnect;
> synchronized(this) {
> @@ -296,7 +298,8 @@
> } else {
> if(logMINOR) Logger.minor(this, "Want
> peer because not enough opennet nodes");
> }
> - timeLastOffered = System.currentTimeMillis();
> + if(nodeToAddNow != null || !notSendingOffer)
> + timeLastOffered =
> System.currentTimeMillis();
> notMany = true;
> }
> noDisconnect = successCount <
> MIN_SUCCESS_BETWEEN_DROP_CONNS;
> @@ -354,9 +357,11 @@
> } else {
> if(!dropList.isEmpty())
> timeLastDropped = now;
> - timeLastOffered = now;
> - if(logMINOR)
> - Logger.minor(this,
> "Sending offer");
> + if(!notSendingOffer) {
> + timeLastOffered = now;
> + if(logMINOR)
> +
> Logger.minor(this, "Sending offer");
> + }
> }
> }
> }
> @@ -434,7 +439,7 @@
> // Re-add it: nasty race condition when we
> have few peers
> }
> }
> - if(!wantPeer(pn, false)) // Start at top as it just succeeded
> + if(!wantPeer(pn, false, false)) // Start at top as it just
> succeeded
> node.peers.disconnect(pn, true, false);
> }
>
>
> Modified: trunk/freenet/src/freenet/node/RequestHandler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/RequestHandler.java 2008-12-05 09:31:18
> UTC (rev 24062)
> +++ trunk/freenet/src/freenet/node/RequestHandler.java 2008-12-05 13:42:13
> UTC (rev 24063)
> @@ -558,7 +558,7 @@
> private boolean finishOpennetNoRelayInner(OpennetManager om) {
> if(logMINOR)
> Logger.minor(this, "Finishing opennet: sending own
> reference");
> - if(!om.wantPeer(null, false))
> + if(!om.wantPeer(null, false, false))
> return false; // Don't want a reference
>
> try {
>
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>