Author: nextgens
Date: 2007-09-30 09:28:55 +0000 (Sun, 30 Sep 2007)
New Revision: 15418
Modified:
trunk/freenet/src/freenet/node/FNPPacketMangler.java
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Use JFK if possible, add a rename bestNegType to selectNegType and explain why.
Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java 2007-09-30
09:21:08 UTC (rev 15417)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java 2007-09-30
09:28:55 UTC (rev 15418)
@@ -2314,7 +2314,7 @@
* @see
freenet.node.OutgoingPacketMangler#sendHandshake(freenet.node.PeerNode)
*/
public void sendHandshake(PeerNode pn) {
- int negType = pn.bestNegType(this);
+ int negType = pn.selectNegType(this);
if(negType == -1) {
if(pn.isRoutingCompatible())
Logger.error(this, "Could not negotiate with
"+pn+" : no common negTypes available!: his negTypes:
"+StringArray.toString(pn.negTypes)+" my negTypes:
"+StringArray.toString(supportedNegTypes())+" despite being up to date!!");
@@ -2398,7 +2398,7 @@
}
public int[] supportedNegTypes() {
- return new int[] { 1, 2 };
+ return new int[] { 2, 1 };
}
public int fullHeadersLengthOneMessage() {
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2007-09-30 09:21:08 UTC
(rev 15417)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2007-09-30 09:28:55 UTC
(rev 15418)
@@ -2642,8 +2642,14 @@
return null;
}
-
- public int bestNegType(OutgoingPacketMangler mangler) {
+ /**
+ * Select the most appropriate negType, taking the user's preference
into account
+ * order matters
+ *
+ * @param mangler
+ * @return -1 if no common negType has been found
+ */
+ public int selectNegType(OutgoingPacketMangler mangler) {
int[] hisNegTypes;
int[] myNegTypes = mangler.supportedNegTypes();
synchronized(this) {