Author: toad
Date: 2008-09-25 01:24:43 +0000 (Thu, 25 Sep 2008)
New Revision: 22833
Added:
branches/db4o/freenet/src/freenet/node/NodeToNodeMessageListener.java
branches/db4o/freenet/test/freenet/support/UpdatableSortedLinkedListTest.java
Modified:
branches/db4o/freenet/README
branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkCategory.java
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
branches/db4o/freenet/src/freenet/io/comm/MessageCore.java
branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
branches/db4o/freenet/src/freenet/node/Announcer.java
branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
branches/db4o/freenet/src/freenet/node/LocationManager.java
branches/db4o/freenet/src/freenet/node/NetworkIDManager.java
branches/db4o/freenet/src/freenet/node/Node.java
branches/db4o/freenet/src/freenet/node/NodeIPDetector.java
branches/db4o/freenet/src/freenet/node/NodeIPPortDetector.java
branches/db4o/freenet/src/freenet/node/NodeStarter.java
branches/db4o/freenet/src/freenet/node/SecurityLevels.java
branches/db4o/freenet/src/freenet/node/Version.java
branches/db4o/freenet/src/freenet/node/simulator/BootstrapPullTest.java
branches/db4o/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
branches/db4o/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeBusyNetworkTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodePingTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
branches/db4o/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
branches/db4o/freenet/src/freenet/node/simulator/SeednodePingTest.java
branches/db4o/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
Log:
Merge 1164 into db4o branch: 22610 -> 22682
Modified: branches/db4o/freenet/README
===================================================================
--- branches/db4o/freenet/README 2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/README 2008-09-25 01:24:43 UTC (rev 22833)
@@ -14,4 +14,20 @@
The installer creates a firefox profile. If you don't use it, you should have
a
look at user.js in the firefox_profile directory for some useful settings for
-browsing Freenet (both for performance and security).
+browsing Freenet (both for performance and security). Occasionally, Firefox can
+decide that the Freenet profile should be the default profile. In the past this
+has happened if you close the Freenet browser window after the main firefox
+window, but recently (FF2, FF3), we have been unable to reproduce the bug,
+although we continue to get reports from time to time. Anyway, to fix it, open
+a command line, cd to where firefox is installed, and type:
+
+firefox -ProfileManager
+
+And choose which profile you want.
+
+On OS/X and unix-based systems, Freenet will create a cron job to run Freenet
+on startup. On Windows it creates a user for Freenet to run under, and a
service
+to start it. You should run Freenet as close to 24x7 as possible for good
+performance. It is however possible to remove the cron job (with the remove
cron
+job script in bin/), or to remove the service (from the services panel in
Control
+Panel).
\ No newline at end of file
Modified:
branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -103,7 +103,7 @@
}
}
- class FProxyPassthruMaxSize extends LongCallback {
+ static class FProxyPassthruMaxSize extends LongCallback {
@Override
public Long get() {
Modified: branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -7,7 +7,6 @@
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
@@ -33,11 +32,8 @@
static final NumberFormat thousendPoint = NumberFormat.getInstance();
- static class MyComparator implements Comparator {
-
- public int compare(Object arg0, Object arg1) {
- Object[] row0 = (Object[])arg0;
- Object[] row1 = (Object[])arg1;
+ static class MyComparator implements Comparator<Object[]> {
+ public int compare(Object[] row0, Object[] row1) {
Integer stat0 = (Integer) row0[2]; // 2 = status
Integer stat1 = (Integer) row1[2];
int x = stat0.compareTo(stat1);
@@ -131,10 +127,8 @@
/* gather connection statistics */
PeerNodeStatus[] peerNodeStatuses =
peers.getPeerNodeStatuses(true);
- Arrays.sort(peerNodeStatuses, new Comparator() {
- public int compare(Object first, Object second) {
- PeerNodeStatus firstNode = (PeerNodeStatus)
first;
- PeerNodeStatus secondNode = (PeerNodeStatus)
second;
+ Arrays.sort(peerNodeStatuses, new Comparator<PeerNodeStatus>() {
+ public int compare(PeerNodeStatus firstNode,
PeerNodeStatus secondNode) {
int statusDifference =
firstNode.getStatusValue() - secondNode.getStatusValue();
if (statusDifference != 0) {
return statusDifference;
@@ -172,8 +166,8 @@
contentNode.addChild(core.alerts.createSummary());
final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, request, contentNode);
- double swaps = (double)node.getSwaps();
- double noSwaps = (double)node.getNoSwaps();
+ double swaps = node.getSwaps();
+ double noSwaps = node.getNoSwaps();
HTMLNode overviewTable = contentNode.addChild("table", "class",
"column");
HTMLNode overviewTableRow = overviewTable.addChild("tr");
@@ -401,13 +395,13 @@
HTMLNode jvmStatsList = jvmStatsInfoboxContent.addChild("ul");
Runtime rt = Runtime.getRuntime();
- float freeMemory = (float) rt.freeMemory();
- float totalMemory = (float) rt.totalMemory();
- float maxMemory = (float) rt.maxMemory();
+ long freeMemory = rt.freeMemory();
+ long totalMemory = rt.totalMemory();
+ long maxMemory = rt.maxMemory();
- long usedJavaMem = (long)(totalMemory - freeMemory);
- long allocatedJavaMem = (long)totalMemory;
- long maxJavaMem = (long)maxMemory;
+ long usedJavaMem = totalMemory - freeMemory;
+ long allocatedJavaMem = totalMemory;
+ long maxJavaMem = maxMemory;
int availableCpus = rt.availableProcessors();
int threadCount = stats.getActiveThreadCount();
@@ -633,20 +627,18 @@
unclaimedFIFOMessageCountsInfobox.addChild("div", "class",
"infobox-header", "unclaimedFIFO Message Counts");
HTMLNode unclaimedFIFOMessageCountsInfoboxContent =
unclaimedFIFOMessageCountsInfobox.addChild("div", "class", "infobox-content");
HTMLNode unclaimedFIFOMessageCountsList =
unclaimedFIFOMessageCountsInfoboxContent.addChild("ul");
- Map unclaimedFIFOMessageCountsMap =
node.getUSM().getUnclaimedFIFOMessageCounts();
+ Map<String, Integer> unclaimedFIFOMessageCountsMap =
node.getUSM().getUnclaimedFIFOMessageCounts();
STMessageCount[] unclaimedFIFOMessageCountsArray = new
STMessageCount[unclaimedFIFOMessageCountsMap.size()];
int i = 0;
int totalCount = 0;
- for (Iterator messageCounts =
unclaimedFIFOMessageCountsMap.keySet().iterator(); messageCounts.hasNext(); ) {
- String messageName = (String) messageCounts.next();
- int messageCount = ((Integer)
unclaimedFIFOMessageCountsMap.get(messageName)).intValue();
+ for (Map.Entry<String, Integer> e :
unclaimedFIFOMessageCountsMap.entrySet()) {
+ String messageName = e.getKey();
+ int messageCount = e.getValue();
totalCount = totalCount + messageCount;
unclaimedFIFOMessageCountsArray[i++] = new
STMessageCount( messageName, messageCount );
}
- Arrays.sort(unclaimedFIFOMessageCountsArray, new Comparator() {
- public int compare(Object first, Object second) {
- STMessageCount firstCount = (STMessageCount)
first;
- STMessageCount secondCount = (STMessageCount)
second;
+ Arrays.sort(unclaimedFIFOMessageCountsArray, new
Comparator<STMessageCount>() {
+ public int compare(STMessageCount firstCount,
STMessageCount secondCount) {
return secondCount.messageCount -
firstCount.messageCount; // sort in descending order
}
});
@@ -997,7 +989,7 @@
int networkSizeEstimateSession =
stats.getNetworkSizeEstimate(-1);
int networkSizeEstimate24h = 0;
int networkSizeEstimate48h = 0;
- double numberOfRemotePeerLocationsSeenInSwaps =
(double)node.getNumberOfRemotePeerLocationsSeenInSwaps();
+ double numberOfRemotePeerLocationsSeenInSwaps =
node.getNumberOfRemotePeerLocationsSeenInSwaps();
if(nodeUptimeSeconds > (24*60*60)) { // 24 hours
networkSizeEstimate24h =
stats.getNetworkSizeEstimate(now - (24*60*60*1000)); // 48 hours
@@ -1049,7 +1041,7 @@
stats.rootThreadGroup.enumerate(threads);
if(threads[threads.length-1] == null) break;
}
- LinkedHashMap map = new LinkedHashMap();
+ LinkedHashMap<String, ThreadBunch> map = new
LinkedHashMap<String, ThreadBunch>();
int totalCount = 0;
for(int i=0;i<threads.length;i++) {
if(threads[i] == null) break;
@@ -1060,7 +1052,7 @@
name = name.substring(0, name.indexOf("@"));
if (name.indexOf("(") != -1)
name = name.substring(0, name.indexOf("("));
- ThreadBunch bunch = (ThreadBunch) map.get(name);
+ ThreadBunch bunch = map.get(name);
if(bunch != null) {
bunch.count++;
} else {
@@ -1068,12 +1060,9 @@
}
totalCount++;
}
- ThreadBunch[] bunches = (ThreadBunch[])
map.values().toArray(new ThreadBunch[map.size()]);
- Arrays.sort(bunches, new Comparator() {
-
- public int compare(Object arg0, Object arg1) {
- ThreadBunch b0 = (ThreadBunch) arg0;
- ThreadBunch b1 = (ThreadBunch) arg1;
+ ThreadBunch[] bunches = map.values().toArray(new
ThreadBunch[map.size()]);
+ Arrays.sort(bunches, new Comparator<ThreadBunch>() {
+ public int compare(ThreadBunch b0, ThreadBunch b1) {
if(b0.count > b1.count) return -1;
if(b0.count < b1.count) return 1;
return b0.name.compareTo(b1.name);
@@ -1272,7 +1261,7 @@
// Make our own peer stand out from the crowd better so
we can see it easier
offset = -10;
} else {
- offset = (int) (((double) PEER_CIRCLE_INNER_RADIUS) *
(1.0 - strength));
+ offset = (int) (PEER_CIRCLE_INNER_RADIUS * (1.0 -
strength));
}
double x = PEER_CIRCLE_ADDITIONAL_FREE_SPACE +
PEER_CIRCLE_RADIUS + Math.sin(peerLocation) * (PEER_CIRCLE_RADIUS - offset);
double y = PEER_CIRCLE_RADIUS - Math.cos(peerLocation) *
(PEER_CIRCLE_RADIUS - offset); // no PEER_CIRCLE_ADDITIONAL_FREE_SPACE for
y-disposition
Modified:
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkCategory.java
===================================================================
---
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkCategory.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkCategory.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -1,8 +1,9 @@
package freenet.clients.http.bookmark;
+import java.util.Vector;
+
import freenet.node.FSParseException;
import freenet.support.SimpleFieldSet;
-import java.util.Vector;
public class BookmarkCategory extends Bookmark {
public static final String NAME = "BookmarkCategory";
@@ -113,7 +114,7 @@
return toStrings("").toArray(new String[0]);
}
- // Iternal use only
+ // Internal use only
private Vector<String> toStrings(String prefix) {
Vector<String> strings = new Vector<String>();
Modified:
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
===================================================================
---
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.1 on 9/8/08 7:31 PM */
+/* The following code was generated by JFlex 1.4.1 on 9/12/08 9:31 PM */
/* This code is part of Freenet. It is distributed under the GNU General
* Public License, version 2 (or at your option any later version). See
@@ -18,8 +18,8 @@
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1
- * on 9/8/08 7:31 PM from the specification file
- * <tt>src/freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt>
+ * on 9/12/08 9:31 PM from the specification file
+ * <tt>./src/freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt>
*/
class CSSTokenizerFilter {
@@ -969,7 +969,7 @@
return L10n.getString("CSSTokenizerFilter."+key);
}
- class DecodedStringThingy {
+ static class DecodedStringThingy {
char quote; // " " means not quoted
boolean url; // in a url() ?
String data;
Modified:
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
===================================================================
---
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
2008-09-25 01:24:43 UTC (rev 22833)
@@ -82,7 +82,7 @@
return L10n.getString("CSSTokenizerFilter."+key);
}
- class DecodedStringThingy {
+ static class DecodedStringThingy {
char quote; // " " means not quoted
boolean url; // in a url() ?
String data;
Modified: branches/db4o/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/MessageCore.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/io/comm/MessageCore.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -36,7 +36,7 @@
private Dispatcher _dispatcher;
/** _filters serves as lock for both */
private final LinkedList _filters = new LinkedList();
- private final LinkedList _unclaimed = new LinkedList();
+ private final LinkedList<Message> _unclaimed = new
LinkedList<Message>();
private static final int MAX_UNMATCHED_FIFO_SIZE = 50000;
private static final long MAX_UNCLAIMED_FIFO_ITEM_LIFETIME =
10*60*1000; // 10 minutes; maybe this should be per message type??
// Every second, remove all timed out filters
@@ -150,7 +150,7 @@
((PeerNode)m.getSource()).addToLocalNodeReceivedMessagesFromStatistic(m);
}
boolean matched = false;
- if ((!(m.getSpec().equals(DMT.packetTransmit))) && logMINOR) {
+ if (!(m.getSpec().equals(DMT.packetTransmit))) {
if(logMINOR) Logger.minor(this, "" +
(System.currentTimeMillis() % 60000) + ' ' + from + " <- "
+ m.getSource() + " : " + m);
}
@@ -518,13 +518,13 @@
}
}
- public Map getUnclaimedFIFOMessageCounts() {
- Map messageCounts = new HashMap();
+ public Map<String, Integer> getUnclaimedFIFOMessageCounts() {
+ Map<String, Integer> messageCounts = new HashMap<String,
Integer>();
synchronized(_filters) {
- for (ListIterator i = _unclaimed.listIterator();
i.hasNext();) {
- Message m = (Message) i.next();
+ for (ListIterator<Message> i =
_unclaimed.listIterator(); i.hasNext();) {
+ Message m = i.next();
String messageName = m.getSpec().getName();
- Integer messageCount = (Integer)
messageCounts.get(messageName);
+ Integer messageCount =
messageCounts.get(messageName);
if (messageCount == null) {
messageCounts.put(messageName, new
Integer(1) );
} else {
Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
2008-09-25 01:24:43 UTC (rev 22833)
@@ -362,8 +362,8 @@
FProxyToadlet.statsTitle=Statistics
FProxyToadlet.unableToRetrieve=Freenet was unable to retrieve this file.
FProxyToadlet.unknownMIMEType=MIME type: unknown
-FProxyToadlet.welcome=homepage
-FProxyToadlet.welcomeTitle=Home
+FProxyToadlet.welcome=browse freenet
+FProxyToadlet.welcomeTitle=Browse Freenet
FcpServer.allowedHosts=Allowed hosts (read the warning!)
FcpServer.allowedHostsFullAccess=Hosts allowed full access
FcpServer.allowedHostsFullAccessLong=IP addresses which are allowed full
access to the node. Clients on these IPs may restart the node, reconfigure it,
etc. Note that ALL clients are allowed to do direct disk I/O!
Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
2008-09-25 01:24:43 UTC (rev 22833)
@@ -134,8 +134,8 @@
ConnectivityToadlet.addressTitle=Adresse
ConnectivityToadlet.byIPTitle=Paquets pour ${ip} par adresse IP - ${status}
(dur?e de vie minimum du tunnel ${tunnelLength})
ConnectivityToadlet.byPortTitle=Paquets pour ${port} par port - ${status}
(dur?e de vie minimum du tunnel ${tunnelLength})
-ConnectivityToadlet.connectivity=Raccordement ? Internet
-ConnectivityToadlet.connectivityTitle=Raccordement r?seau
+ConnectivityToadlet.connectivity=Connexion Internet
+ConnectivityToadlet.connectivityTitle=Connexion Internet
ConnectivityToadlet.firstReceiveLeadTime=D?lai avant la premi?re r?ception
ConnectivityToadlet.firstSendLeadTime=D?lai avant le premier envoi
ConnectivityToadlet.local=LOCAL
@@ -144,7 +144,7 @@
ConnectivityToadlet.remote=DISTANT
ConnectivityToadlet.sentReceivedTitle=Paquets envoy?s/re?us
ConnectivityToadlet.summaryTitle=Raccordement r?seau
-ConnectivityToadlet.title=Raccordement internet de ${nodeName}
+ConnectivityToadlet.title=Connexion internet de ${nodeName}
ContentDataFilter.unknownCharset=La page que vous essayez d'afficher utilise
un jeu de caract?re inconnu. Cela signifie que le noeud ne pourra pas la
filtrer, et qu'elle pourait compromettre votre anonymat.
ContentDataFilter.unknownCharsetTitle=Jeu de caract?res inconnu !
ContentDataFilter.warningUnknownCharsetTitle=Attention : Jeu de caract?res
inconnu (${charset})
@@ -257,8 +257,8 @@
ExtOldAgeUserAlert.extTooOldShort=Votre freenet-ext.jar est ancien. Veuillez
mettre ? jour.
ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext trop ancien
FProxyToadlet.abortToHomepage=Annuler et revenir ? la page d'accueil
-FProxyToadlet.alerts=messages d?taill?s
-FProxyToadlet.alertsTitle=Alertes
+FProxyToadlet.alerts=messages d?taill?s et messages de vos Amis
+FProxyToadlet.alertsTitle=Messages
FProxyToadlet.backToFProxy=${link}Cliquez ici${/link} pour revenir ? la page
d'accueil
FProxyToadlet.backToReferrer=${link}Cliquez ici${/link} pour revenir ? la page
pr?c?dente
FProxyToadlet.cantBindPort=Fproxy ne peut pas ?couter sur ce port !
@@ -278,7 +278,7 @@
FProxyToadlet.fileInformationTitle=Informations sur le fichier
FProxyToadlet.filenameLabel=Nom de fichier :
FProxyToadlet.friends=G?rer les connexions avec les Amis
-FProxyToadlet.friendsTitle=Amis
+FProxyToadlet.friendsTitle=Connexions aux Amis
FProxyToadlet.goBack=Retour
FProxyToadlet.goBackToPrev=Revenir ? la page pr?c?dente
FProxyToadlet.invalidKeyTitle=Cl? invalide
@@ -300,14 +300,14 @@
FProxyToadlet.openRSSForce=${link}Cliquez ici${/link} pour ouvrir le fichier
en tant que ${mime} (ceci ${bold}peut ?tre dangereux${/bold} avec IE7 et FF2).
FProxyToadlet.openWithKeyExplorer=${link}Cliquez ici${/link} pour ouvrir cette
URI avec Key Explorer.
FProxyToadlet.opennet=G?rer les connexions aux Inconnus
-FProxyToadlet.opennetTitle=Inconnus
+FProxyToadlet.opennetTitle=Connexions aux Inconnus
FProxyToadlet.options=Les choix possibles sont :
FProxyToadlet.pathNotFound=Le chemin sp?cifi? n'existe pas.
FProxyToadlet.pathNotFoundTitle=Chemin non trouv?
FProxyToadlet.plugins=Configurer et g?rer les plugins
FProxyToadlet.pluginsTitle=Plugins
FProxyToadlet.queue=G?rer les requ?tes en attente
-FProxyToadlet.queueTitle=File d'attente
+FProxyToadlet.queueTitle=T?l?chargements et insertions
FProxyToadlet.retryNow=R?essayer maintenant
FProxyToadlet.sizeLabel=Taille :
FProxyToadlet.sizeUnknown=Taille : inconnue
@@ -722,14 +722,14 @@
Node.storeBloomFilterCounting=Utiliser un filtre de Bloom ?
Node.storeBloomFilterCountingLong=Utiliser un filtre de Bloom sur 2 bits ? (ne
touchez ? cel? que si vous savez ce que vous faites)
Node.storeBloomFilterSize=Taille (totale) du filtre de Bloom en octets
-Node.storeBloomFilterSizeLong=Taille (totale) du filtre de Bloom.
Habituellement 1/2048?me de la taille du datastore suffit largement. Mettez ?
z?ro pour d?sactiver le filtre de Bloom.
+Node.storeBloomFilterSizeLong=Taille (totale) du filtre de Bloom.
Habituellement 1/2048?me de la taille du datastore suffit largement. Mettez ?
z?ro pour d?sactiver le filtre de Bloom. Mettez ? -1 pour remettre par d?faut.
Node.storeDirectory=Dossier du store
Node.storeDirectoryLong=Dossier o? placer le store
Node.storeMaxMemTooHigh=Vous ne voulez s?rement pas donner plus de 80% de
votre m?moire ? BDB !
Node.storeSize=Taille du store en octets
Node.storeSizeLong=Taille du store en octets
Node.storeType=Type de store (NE PAS CHANGER)
-Node.storeTypeLong=Type du datastore. Actuellement, ?a peut ?tre salt-hash
(une table de hashage sur disque avec filre de Bloom), bdb-index (utilisation
d'un BerkeleyDBFreenetStore pour stocker l'index, et de fichiers pour les
donn?es), ou ram (index et donn?es sont stock?s en m?moire). Utilisez ram
uniquement si vous savez ce que vous faites et avez suffisamment de RAM pour
stocker toutes les donn?es (tout sera perdu ? l'arr?t du noeud) ! Les
changements ne seront appliqu?s qu'apr?s le red?marrage de Freenet.
+Node.storeTypeLong=Type du datastore. Actuellement, ?a peut ?tre salt-hash
(EXPERIMENTAL, une table de hashage sur disque avec filre de Bloom), bdb-index
(STABLE, utilisation d'un BerkeleyDBFreenetStore pour stocker l'index, et de
fichiers pour les donn?es), ou ram (POUR TEST UNIQUEMENT, index et donn?es sont
stock?s en m?moire). Utilisez ram uniquement si vous savez ce que vous faites
et avez suffisamment de RAM pour stocker toutes les donn?es (tout sera perdu ?
l'arr?t du noeud) ! Les changements ne seront appliqu?s qu'apr?s le red?marrage
de Freenet.
Node.swapRInterval=Intervalle entre les demandes de permutation (ms)
Node.swapRIntervalLong=Intervale entre chaque demande de permutation, en
millisecondes. Laissez tel quel !
Node.throttleLocalTraffic=Limiter le traffic local ?
@@ -1328,9 +1328,9 @@
UserAlertManager.minorCountLabel=Mineur :
UserAlertManager.totalLabel=Total :
UserAlertManager.warningCountLabel=Avertissements :
-UserAlertsToadlet.titleWithName=Alertes pour ${name}
+UserAlertsToadlet.titleWithName=Messages pour ${name}
WelcomeToadlet.activityTitle=Activit? du moment
-WelcomeToadlet.alertsSummary=Liste des alertes (cliquez pour plus d'infos ou
pour changer quelque chose)
+WelcomeToadlet.alertsSummary=R?sum? des messages (cliquez pour plus d'infos ou
pour changer quelque chose)
WelcomeToadlet.arkFetchCount=R?cup?rations d'ARK : ${total}
WelcomeToadlet.confirmAddBookmarkSubTitle=Confirmer l'ajout de marque-page
WelcomeToadlet.confirmAddBookmarkTitle=Ajouter un marque-page
Modified: branches/db4o/freenet/src/freenet/node/Announcer.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Announcer.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/Announcer.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -88,6 +88,7 @@
System.err.println("Attempting announcement to
seednodes...");
synchronized(this) {
status = STATUS_LOADING;
+ started = true;
}
connectSomeSeednodes();
} else {
@@ -95,6 +96,9 @@
// Wait a minute, then check whether we need to seed.
node.getTicker().queueTimedJob(new Runnable() {
public void run() {
+ synchronized(Announcer.this) {
+ started = true;
+ }
try {
maybeSendAnnouncement();
} catch (Throwable t) {
@@ -310,7 +314,9 @@
private boolean dontKnowOurIPAddress;
public void maybeSendAnnouncement() {
- started = true;
+ synchronized(this) {
+ if(!started) return;
+ }
logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR)
Logger.minor(this, "maybeSendAnnouncement()");
Modified: branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -47,6 +47,11 @@
* if we receive an offer from that node, we will reject it */
static final int MAX_TIME_BETWEEN_REQUEST_AND_OFFER = 60 * 60 * 1000;
+ public static final long[] EMPTY_LONG_ARRAY = new long[0];
+ public static final short[] EMPTY_SHORT_ARRAY = new short[0];
+ public static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
+ public static final WeakReference[] EMPTY_WEAK_REFERENCE = new
WeakReference[0];
+
FailureTableEntry(Key key) {
this.key = key;
if(key == null) throw new NullPointerException();
@@ -55,15 +60,15 @@
creationTime = now;
receivedTime = -1;
sentTime = -1;
- requestorNodes = new WeakReference[0];
- requestorTimes = new long[0];
- requestorBootIDs = new long[0];
- requestedNodes = new WeakReference[0];
- requestedLocs = new double[0];
- requestedBootIDs = new long[0];
- requestedTimes = new long[0];
- requestedTimeouts = new long[0];
- requestedTimeoutHTLs = new short[0];
+ requestorNodes = EMPTY_WEAK_REFERENCE;
+ requestorTimes = EMPTY_LONG_ARRAY;
+ requestorBootIDs = EMPTY_LONG_ARRAY;
+ requestedNodes = EMPTY_WEAK_REFERENCE;
+ requestedLocs = EMPTY_DOUBLE_ARRAY;
+ requestedBootIDs = EMPTY_LONG_ARRAY;
+ requestedTimes = EMPTY_LONG_ARRAY;
+ requestedTimeouts = EMPTY_LONG_ARRAY;
+ requestedTimeoutHTLs = EMPTY_SHORT_ARRAY;
}
/**
@@ -338,8 +343,8 @@
anyValid = true;
}
if(!anyValid) {
- requestorNodes = new WeakReference[0];
- requestorTimes = requestorBootIDs = new long[0];
+ requestorNodes = EMPTY_WEAK_REFERENCE;
+ requestorTimes = requestorBootIDs = EMPTY_LONG_ARRAY;
}
return anyValid;
}
@@ -369,8 +374,8 @@
}
}
if(!anyValid) {
- requestorNodes = new WeakReference[0];
- requestorTimes = requestorBootIDs = new long[0];
+ requestorNodes = EMPTY_WEAK_REFERENCE;
+ requestorTimes = requestorBootIDs = EMPTY_LONG_ARRAY;;
}
return ret;
}
@@ -401,9 +406,9 @@
}
}
if(!anyValid) {
- requestedNodes = new WeakReference[0];
- requestedTimes = requestedBootIDs = requestedTimeouts =
new long[0];
- requestedTimeoutHTLs = new short[0];
+ requestedNodes = EMPTY_WEAK_REFERENCE;
+ requestedTimes = requestedBootIDs = requestedTimeouts =
EMPTY_LONG_ARRAY;
+ requestedTimeoutHTLs =EMPTY_SHORT_ARRAY;
}
return ret;
}
Modified: branches/db4o/freenet/src/freenet/node/LocationManager.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/LocationManager.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/LocationManager.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -170,6 +170,10 @@
}
if(System.currentTimeMillis() >= endTime) break;
}
+ // FIXME shut down the swap initiator thread when swapping
is disabled and re-enable it when swapping comes back up.
+ if(swappingDisabled()) {
+ continue;
+ }
// Don't send one if we are locked
if(lock()) {
if(System.currentTimeMillis() -
timeLastSuccessfullySwapped > 30*1000) {
@@ -230,7 +234,22 @@
"Outgoing swap request handler for port
"+node.getDarknetPortNumber());
}
- public int getSendSwapInterval() {
+ /**
+ * Should we swap? LOCKING: Call without holding locks.
+ * @return
+ */
+ public boolean swappingDisabled() {
+ // Swapping on opennet nodes, even hybrid nodes, causes significant and
unnecessary location churn.
+ // Simulations show significantly improved performance if all opennet
enabled nodes don't participate in swapping.
+ // FIXME: Investigate the possibility of enabling swapping on hybrid
nodes with mostly darknet peers (more simulation needed).
+ // FIXME: Hybrid nodes with all darknet peeers who haven't upgraded to
HIGH.
+ // Probably we should have a useralert for this to get the user to do
the right thing ... but we could auto-detect
+ // it and start swapping... however, we should not start swapping just
because we temporarily have no opennet peers
+ // on startup.
+ return node.isOpennetEnabled();
+ }
+
+ public int getSendSwapInterval() {
int interval = (int) averageSwapTime.currentValue();
if(interval < MIN_SWAP_TIME)
interval = MIN_SWAP_TIME;
@@ -896,7 +915,7 @@
htl = SWAP_MAX_HTL;
}
htl--;
- if(!node.enableSwapping) {
+ if(!node.enableSwapping || htl <= 0 && swappingDisabled()) {
// Reject
Message reject = DMT.createFNPSwapRejected(oldID);
try {
Modified: branches/db4o/freenet/src/freenet/node/NetworkIDManager.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NetworkIDManager.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/NetworkIDManager.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -99,7 +99,7 @@
long secret = m.getLong(DMT.SECRET);
StoredSecret s=new StoredSecret(pn, uid, secret);
if (logMINOR) Logger.minor(this, "Storing secret: "+s);
- addOrReplaceSecret(s);
+ addOrReplaceSecret(s); // FIXME - what if the message contain a
bogus UID?
try {
pn.sendAsync(DMT.createFNPAccepted(uid), null, 0, ctr);
} catch (NotConnectedException e) {
@@ -264,8 +264,8 @@
private void removeSecret(StoredSecret s) {
//synchronized (secretsByPeer) in calling functions
- secretsByPeer.remove(s);
- secretsByUID.remove(s);
+ secretsByPeer.remove(s.peer);
+ secretsByUID.remove(s.uid);
}
private static final class StoredSecret {
Modified: branches/db4o/freenet/src/freenet/node/Node.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Node.java 2008-09-25 01:21:24 UTC
(rev 22832)
+++ branches/db4o/freenet/src/freenet/node/Node.java 2008-09-25 01:24:43 UTC
(rev 22833)
@@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
+import java.util.Map;
import java.util.MissingResourceException;
import java.util.Random;
import java.util.Set;
@@ -145,10 +146,7 @@
private final static ClockProblemDetectedUserAlert
clockProblemDetectedUserAlert = new ClockProblemDetectedUserAlert();
public class NodeNameCallback extends StringCallback {
- GetPubkey node;
-
- NodeNameCallback(GetPubkey n) {
- node=n;
+ NodeNameCallback() {
}
@Override
public String get() {
@@ -1547,7 +1545,7 @@
// Name
nodeConfig.register("name", myName, sortOrder++, false, true,
"Node.nodeName", "Node.nodeNameLong",
- new NodeNameCallback(this));
+ new NodeNameCallback());
myName = nodeConfig.getString("name");
// Datastore
@@ -2045,6 +2043,9 @@
throw new
NodeInitException(NodeInitException.EXIT_COULD_NOT_START_UPDATER, "Could not
create Updater: "+e);
}
+ registerNodeToNodeMessageListener(N2N_MESSAGE_TYPE_FPROXY,
fproxyN2NMListener);
+
registerNodeToNodeMessageListener(Node.N2N_MESSAGE_TYPE_DIFFNODEREF,
diffNoderefListener);
+
Logger.normal(this, "Node constructor completed");
System.out.println("Node constructor completed");
}
@@ -2140,13 +2141,14 @@
// If we are running a Sun or Blackdown JVM, on Linux, and
LD_ASSUME_KERNEL is not set, then we are.
String jvmVendor = System.getProperty("java.vm.vendor");
+ String jvmSpecVendor =
System.getProperty("java.specification.vendor","");
String jvmVersion = System.getProperty("java.version");
String osName = System.getProperty("os.name");
String osVersion = System.getProperty("os.version");
if(logMINOR) Logger.minor(this, "JVM vendor: "+jvmVendor+", JVM
version: "+jvmVersion+", OS name: "+osName+", OS version: "+osVersion);
- if(jvmVendor.startsWith("Sun ")) {
+ if(jvmVendor.startsWith("Sun ") || (jvmVendor.startsWith("The
FreeBSD Foundation") && jvmSpecVendor.startsWith("Sun "))) {
// Sun bugs
// Spurious OOMs
@@ -3233,6 +3235,12 @@
return (buildOldAgeUserAlert.lastGoodVersion > 0);
}
+ private Map<Integer, NodeToNodeMessageListener> n2nmListeners = new
HashMap<Integer, NodeToNodeMessageListener>();
+
+ public synchronized void registerNodeToNodeMessageListener(int type,
NodeToNodeMessageListener listener) {
+ n2nmListeners.put(type, listener);
+ }
+
/**
* Handle a received node to node message
*/
@@ -3247,20 +3255,56 @@
if(src instanceof DarknetPeerNode) {
fromDarknet = true;
}
- DarknetPeerNode darkSource = null;
- if(fromDarknet) {
- darkSource = (DarknetPeerNode)src;
+
+ NodeToNodeMessageListener listener = null;
+ synchronized(this) {
+ listener = n2nmListeners.get(type);
}
- if(type == Node.N2N_MESSAGE_TYPE_FPROXY) {
+ if(listener == null) {
+ Logger.error(this, "Unknown n2nm ID: "+type+" -
discarding packet length "+messageData.getLength());
+ return;
+ }
+
+ listener.handleMessage(messageData.getData(), fromDarknet, src,
type);
+ }
+
+ private NodeToNodeMessageListener diffNoderefListener = new
NodeToNodeMessageListener() {
+
+ public void handleMessage(byte[] data, boolean fromDarknet,
PeerNode src, int type) {
+ Logger.normal(this, "Received differential node
reference node to node message from "+src.getPeer());
+ SimpleFieldSet fs = null;
+ try {
+ fs = new SimpleFieldSet(new String(data,
"UTF-8"), false, true);
+ } catch (IOException e) {
+ Logger.error(this, "IOException while parsing
node to node message data", e);
+ return;
+ }
+ if(fs.get("n2nType") != null) {
+ fs.removeValue("n2nType");
+ }
+ try {
+ src.processDiffNoderef(fs);
+ } catch (FSParseException e) {
+ Logger.error(this, "FSParseException while
parsing node to node message data", e);
+ return;
+ }
+ }
+
+ };
+
+ private NodeToNodeMessageListener fproxyN2NMListener = new
NodeToNodeMessageListener() {
+
+ public void handleMessage(byte[] data, boolean fromDarknet,
PeerNode src, int type) {
if(!fromDarknet) {
Logger.error(this, "Got N2NTM from non-darknet
node ?!?!?!: from "+src);
return;
}
+ DarknetPeerNode darkSource = (DarknetPeerNode) src;
Logger.normal(this, "Received N2NTM from
'"+darkSource.getPeer()+"'");
SimpleFieldSet fs = null;
try {
- fs = new SimpleFieldSet(new
String(messageData.getData(), "UTF-8"), false, true);
+ fs = new SimpleFieldSet(new String(data,
"UTF-8"), false, true);
} catch (IOException e) {
Logger.error(this, "IOException while parsing
node to node message data", e);
return;
@@ -3288,29 +3332,10 @@
// Shouldn't happen
throw new Error(e);
}
- } else if(type == Node.N2N_MESSAGE_TYPE_DIFFNODEREF) {
- Logger.normal(this, "Received differential node
reference node to node message from "+src.getPeer());
- SimpleFieldSet fs = null;
- try {
- fs = new SimpleFieldSet(new
String(messageData.getData(), "UTF-8"), false, true);
- } catch (IOException e) {
- Logger.error(this, "IOException while parsing
node to node message data", e);
- return;
- }
- if(fs.get("n2nType") != null) {
- fs.removeValue("n2nType");
- }
- try {
- src.processDiffNoderef(fs);
- } catch (FSParseException e) {
- Logger.error(this, "FSParseException while
parsing node to node message data", e);
- return;
- }
- } else {
- Logger.error(this, "Received unknown node to node
message type '"+type+"' from "+src.getPeer());
}
- }
-
+
+ };
+
/**
* Handle a node to node text message SimpleFieldSet
* @throws FSParseException
Modified: branches/db4o/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeIPDetector.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/NodeIPDetector.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -133,6 +133,7 @@
if(dumpLocalAddresses) {
ArrayList filtered = new
ArrayList(lastIPAddress.length);
for(int i=0;i<lastIPAddress.length;i++) {
+ if(lastIPAddress[i] == null) continue;
if(IPUtil.isValidAddress(lastIPAddress[i].getAddress(), false))
filtered.add(lastIPAddress[i]);
}
Modified: branches/db4o/freenet/src/freenet/node/NodeIPPortDetector.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeIPPortDetector.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/NodeIPPortDetector.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -3,6 +3,7 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.node;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
@@ -59,10 +60,13 @@
* differently for each connection, we're stuffed, and we tell the
user).
*/
Peer[] detectPrimaryPeers() {
+ boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
Vector addresses = new Vector();
FreenetInetAddress[] addrs = detectPrimaryIPAddress();
for(int i=0;i<addrs.length;i++) {
addresses.add(new Peer(addrs[i], crypto.portNumber));
+ if(logMINOR)
+ Logger.minor(this, "Adding "+addrs[i]);
}
// Now try to get the rewritten port number from our peers.
// Only considering those within this crypto port, this time.
@@ -140,6 +144,8 @@
}
}
lastPeers = (Peer[]) addresses.toArray(new
Peer[addresses.size()]);
+ if(logMINOR)
+ Logger.minor(this, "Returning for port
"+crypto.portNumber+" : "+Arrays.toString(lastPeers));
return lastPeers;
}
Modified: branches/db4o/freenet/src/freenet/node/NodeStarter.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeStarter.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/NodeStarter.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -261,7 +261,7 @@
* Not Node-specific; many nodes may be created later.
* @param testName The name of the test instance.
*/
- public static RandomSource globalTestInit(String testName, boolean
enablePlug, int logThreshold, String details) throws InvalidThresholdException {
+ public static RandomSource globalTestInit(String testName, boolean
enablePlug, int logThreshold, String details, boolean noDNS) throws
InvalidThresholdException {
File dir = new File(testName);
if((!dir.mkdir()) && ((!dir.exists()) || (!dir.isDirectory())))
{
@@ -316,7 +316,7 @@
}
FNPPacketMangler.LOG_UNMATCHABLE_ERROR = true;
- DNSRequester.DISABLE = true;
+ DNSRequester.DISABLE = noDNS;
return random;
}
Copied: branches/db4o/freenet/src/freenet/node/NodeToNodeMessageListener.java
(from rev 22682, trunk/freenet/src/freenet/node/NodeToNodeMessageListener.java)
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeToNodeMessageListener.java
(rev 0)
+++ branches/db4o/freenet/src/freenet/node/NodeToNodeMessageListener.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -0,0 +1,11 @@
+package freenet.node;
+
+/**
+ * Something that wants to listen for nodeToNodeMessage's.
+ * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450)
+ */
+public interface NodeToNodeMessageListener {
+
+ public void handleMessage(byte[] data, boolean fromDarknet, PeerNode
source, int type);
+
+}
Modified: branches/db4o/freenet/src/freenet/node/SecurityLevels.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SecurityLevels.java 2008-09-25
01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/SecurityLevels.java 2008-09-25
01:24:43 UTC (rev 22833)
@@ -96,8 +96,14 @@
}
};
- myConfig.register("networkThreatLevel", "NORMAL", sortOrder++,
false, true, "SecurityLevels.networkThreatLevelShort",
"SecurityLevels.networkThreatLevel", networkThreatLevelCallback);
- networkThreatLevel =
NETWORK_THREAT_LEVEL.valueOf(myConfig.getString("networkThreatLevel"));
+ myConfig.register("networkThreatLevel", "HIGH", sortOrder++,
false, true, "SecurityLevels.networkThreatLevelShort",
"SecurityLevels.networkThreatLevel", networkThreatLevelCallback);
+ NETWORK_THREAT_LEVEL netLevel =
NETWORK_THREAT_LEVEL.valueOf(myConfig.getString("networkThreatLevel"));
+ if(myConfig.getRawOption("networkThreatLevel") != null) {
+ networkThreatLevel = netLevel;
+ } else {
+ // Call all the callbacks so that the config is
consistent with the threat level.
+ setThreatLevel(netLevel);
+ }
friendsThreatLevelCallback = new
MyCallback<FRIENDS_THREAT_LEVEL>() {
@Override
@@ -132,7 +138,13 @@
};
myConfig.register("friendsThreatLevel", "NORMAL", sortOrder++,
false, true, "SecurityLevels.friendsThreatLevelShort",
"SecurityLevels.friendsThreatLevel", friendsThreatLevelCallback);
- friendsThreatLevel =
FRIENDS_THREAT_LEVEL.valueOf(myConfig.getString("friendsThreatLevel"));
+ FRIENDS_THREAT_LEVEL friendsLevel =
FRIENDS_THREAT_LEVEL.valueOf(myConfig.getString("friendsThreatLevel"));;
+ if(myConfig.getRawOption("friendsThreatLevel") != null) {
+ friendsThreatLevel = friendsLevel;
+ } else {
+ // Call all the callbacks so that the config is
consistent with the threat level.
+ setThreatLevel(friendsLevel);
+ }
physicalThreatLevelCallback = new
MyCallback<PHYSICAL_THREAT_LEVEL>() {
@Override
@@ -167,7 +179,14 @@
};
myConfig.register("physicalThreatLevel", "NORMAL", sortOrder++,
false, true, "SecurityLevels.physicalThreatLevelShort",
"SecurityLevels.physicalThreatLevel", physicalThreatLevelCallback);
- physicalThreatLevel =
PHYSICAL_THREAT_LEVEL.valueOf(myConfig.getString("physicalThreatLevel"));
+ PHYSICAL_THREAT_LEVEL physLevel =
PHYSICAL_THREAT_LEVEL.valueOf(myConfig.getString("physicalThreatLevel"));
+ if(myConfig.getRawOption("physicalThreatLevel") != null) {
+ physicalThreatLevel = physLevel;
+ } else {
+ // Call all the callbacks so that the config is
consistent with the threat level.
+ setThreatLevel(physLevel);
+ }
+
myConfig.finishedInitialization();
}
Modified: branches/db4o/freenet/src/freenet/node/Version.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Version.java 2008-09-25 01:21:24 UTC
(rev 22832)
+++ branches/db4o/freenet/src/freenet/node/Version.java 2008-09-25 01:24:43 UTC
(rev 22833)
@@ -24,17 +24,17 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- private static final int buildNumber = 1163;
+ private static final int buildNumber = 1164;
/** Oldest build of Fred we will talk to */
- private static final int oldLastGoodBuild = 1162;
- private static final int newLastGoodBuild = 1163;
+ private static final int oldLastGoodBuild = 1163;
+ private static final int newLastGoodBuild = 1164;
static final long transitionTime;
static {
final Calendar _cal =
Calendar.getInstance(TimeZone.getTimeZone("GMT"));
// year, month - 1 (or constant), day, hour, minute, second
- _cal.set( 2008, Calendar.SEPTEMBER, 18, 0, 0, 0 );
+ _cal.set( 2008, Calendar.SEPTEMBER, 22, 0, 0, 0 );
transitionTime = _cal.getTimeInMillis();
}
Modified:
branches/db4o/freenet/src/freenet/node/simulator/BootstrapPullTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/BootstrapPullTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/BootstrapPullTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -62,7 +62,7 @@
ipOverride = args[0];
File dir = new File("bootstrap-pull-test");
FileUtil.removeAll(dir);
- RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "");
+ RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "", false);
byte[] seed = new byte[64];
random.nextBytes(seed);
MersenneTwister fastRandom = new MersenneTwister(seed);
Modified:
branches/db4o/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -43,7 +43,7 @@
ipOverride = args[0];
File dir = new File("bootstrap-push-pull-test");
FileUtil.removeAll(dir);
- RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "");
+ RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "", false);
File seednodes = new File("seednodes.fref");
if(!seednodes.exists() || seednodes.length() == 0 ||
!seednodes.canRead()) {
System.err.println("Unable to read seednodes.fref, it doesn't
exist, or is empty");
Modified:
branches/db4o/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -37,7 +37,7 @@
ipOverride = args[0];
File dir = new File("bootstrap-test");
FileUtil.removeAll(dir);
- RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "");
+ RandomSource random = NodeStarter.globalTestInit(dir.getPath(), false,
Logger.ERROR, "", false);
File seednodes = new File("seednodes.fref");
if(!seednodes.exists() || seednodes.length() == 0 ||
!seednodes.canRead()) {
System.err.println("Unable to read seednodes.fref, it doesn't
exist, or is empty");
Modified:
branches/db4o/freenet/src/freenet/node/simulator/RealNodeBusyNetworkTest.java
===================================================================
---
branches/db4o/freenet/src/freenet/node/simulator/RealNodeBusyNetworkTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/node/simulator/RealNodeBusyNetworkTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -65,7 +65,7 @@
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNode:minor,freenet.node.Insert:MINOR,freenet.node.Request:MINOR,freenet.node.Node:MINOR");
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.Location:MINOR,freenet.io.comm:MINOR,freenet.node.NodeDispatcher:MINOR,freenet.node.simulator:MINOR,freenet.node.PeerManager:MINOR,freenet.node.RequestSender:MINOR");
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.FNP:MINOR,freenet.node.Packet:MINOR,freenet.io.comm:MINOR,freenet.node.PeerNode:MINOR,freenet.node.DarknetPeerNode:MINOR");
- NodeStarter.globalTestInit(name, false, Logger.ERROR, "");
+ NodeStarter.globalTestInit(name, false, Logger.ERROR, "", true);
System.out.println("Busy network test (inserts/retrieves in
quantity/stress test)");
System.out.println();
DummyRandomSource random = new DummyRandomSource();
Modified:
branches/db4o/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
===================================================================
---
branches/db4o/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -54,7 +54,7 @@
String wd = "realNodeNetworkColorTest";
new File(wd).mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(wd, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeNetworkColoringTest:normal,freenet.node.NetworkIDManager:normal");
+ NodeStarter.globalTestInit(wd, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeNetworkColoringTest:normal,freenet.node.NetworkIDManager:normal",
true);
DummyRandomSource random = new DummyRandomSource();
//DiffieHellman.init(random);
Modified: branches/db4o/freenet/src/freenet/node/simulator/RealNodePingTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/RealNodePingTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/RealNodePingTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -30,7 +30,7 @@
public class RealNodePingTest {
public static void main(String[] args) throws FSParseException,
PeerParseException, InterruptedException,
ReferenceSignatureVerificationException, NodeInitException,
InvalidThresholdException {
- RandomSource random = NodeStarter.globalTestInit("pingtest", false,
Logger.ERROR, "");
+ RandomSource random = NodeStarter.globalTestInit("pingtest", false,
Logger.ERROR, "", true);
// Create 2 nodes
Executor executor = new PooledExecutor();
Node node1 = NodeStarter.createTestNode(5001, 0, "pingtest", false,
false, true, Node.DEFAULT_MAX_HTL, 0, random, executor, 1000, 65536, true,
false, false, false, false, false, true, 0, false, false, null);
Modified:
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
===================================================================
---
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -64,7 +64,7 @@
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNode:minor,freenet.node.Insert:MINOR,freenet.node.Request:MINOR,freenet.node.Node:MINOR");
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.Location:MINOR,freenet.io.comm:MINOR,freenet.node.NodeDispatcher:MINOR,freenet.node.simulator:MINOR,freenet.node.PeerManager:MINOR,freenet.node.RequestSender:MINOR");
//NodeStarter.globalTestInit(name, false, Logger.ERROR,
"freenet.node.FNP:MINOR,freenet.node.Packet:MINOR,freenet.io.comm:MINOR,freenet.node.PeerNode:MINOR,freenet.node.DarknetPeerNode:MINOR");
- NodeStarter.globalTestInit(name, false, Logger.ERROR, "");
+ NodeStarter.globalTestInit(name, false, Logger.ERROR, "", true);
System.out.println("Insert/retrieve test");
System.out.println();
DummyRandomSource random = new DummyRandomSource();
Modified:
branches/db4o/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -48,7 +48,7 @@
}
wd.mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(dir, false, Logger.ERROR, "");
+ NodeStarter.globalTestInit(dir, false, Logger.ERROR, "", true);
DummyRandomSource random = new DummyRandomSource();
//DiffieHellman.init(random);
Node[] nodes = new Node[NUMBER_OF_NODES];
Modified:
branches/db4o/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
===================================================================
---
branches/db4o/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -52,7 +52,7 @@
String wd = "realNodeSecretPingTest";
new File(wd).mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(wd, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeSecretPingTest:normal,freenet.node.NetworkIDManager:normal");
+ NodeStarter.globalTestInit(wd, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeSecretPingTest:normal,freenet.node.NetworkIDManager:normal",
true);
DummyRandomSource random = new DummyRandomSource();
//DiffieHellman.init(random);
Modified: branches/db4o/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -87,7 +87,7 @@
//NOTE: globalTestInit returns in ignored random source
//NodeStarter.globalTestInit(testName, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeRoutingTest:normal,freenet.node.NodeDispatcher:NORMAL"
/*,freenet.node.FailureTable:MINOR,freenet.node.Node:MINOR,freenet.node.Request:MINOR,freenet.io.comm.MessageCore:MINOR"
"freenet.store:minor,freenet.node.LocationManager:debug,freenet.node.FNPPacketManager:normal,freenet.io.comm.MessageCore:debug"*/);
- NodeStarter.globalTestInit(testName, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeRoutingTest:normal,freenet.node.NodeDispatcher:NORMAL,freenet.node.FailureTable:MINOR,freenet.node.Node:MINOR,freenet.node.Request:MINOR,freenet.io.comm.MessageCore:MINOR,freenet.node.PeerNode:MINOR,freenet.io.xfer.PacketThrottle:MINOR,freenet.node.PeerManager:MINOR");
+ NodeStarter.globalTestInit(testName, false, Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeRoutingTest:normal,freenet.node.NodeDispatcher:NORMAL,freenet.node.FailureTable:MINOR,freenet.node.Node:MINOR,freenet.node.Request:MINOR,freenet.io.comm.MessageCore:MINOR,freenet.node.PeerNode:MINOR,freenet.io.xfer.PacketThrottle:MINOR,freenet.node.PeerManager:MINOR",
true);
Node[] nodes = new Node[NUMBER_OF_NODES];
Logger.normal(RealNodeRoutingTest.class, "Creating nodes...");
Executor executor = new PooledExecutor();
Modified: branches/db4o/freenet/src/freenet/node/simulator/SeednodePingTest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/simulator/SeednodePingTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/src/freenet/node/simulator/SeednodePingTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -47,7 +47,7 @@
try {
if(args.length == 1)
STATUS_DIR = new File(args[0]);
- RandomSource random = NodeStarter.globalTestInit("seednode-pingtest",
false, Logger.ERROR, "");
+ RandomSource random = NodeStarter.globalTestInit("seednode-pingtest",
false, Logger.ERROR, "", false);
// Create one node
Executor executor = new PooledExecutor();
node = NodeStarter.createTestNode(5000, 5001, "seednode-pingtest",
true, false, false, Node.DEFAULT_MAX_HTL, 0, random, executor, 1000,
5*1024*1024, true, false, false, false, false, false, false, 0, false, false,
null);
Modified:
branches/db4o/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
===================================================================
---
branches/db4o/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -276,6 +276,7 @@
private void sendUOMRequestMain(final PeerNode source, boolean
addOnFail) {
if(logMINOR)
Logger.minor(this,
"sendUOMRequestMain("+source+","+addOnFail+")");
+ if(!source.isConnected()) return;
synchronized(this) {
long offeredVersion = source.getMainJarOfferedVersion();
if(offeredVersion < updateManager.newMainJarVersion()) {
@@ -368,6 +369,7 @@
>=
MAX_NODES_SENDING_MAIN_JAR)
return;
if(nodesSendingMainJar.contains(offers[i])) continue;
+
if(nodesAskedSendMainJar.contains(offers[i])) continue;
}
sendUOMRequestMain(offers[i], false);
}
Modified:
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
---
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-09-25 01:21:24 UTC (rev 22832)
+++
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -151,6 +151,7 @@
flags |= FLAG_REBUILD_BLOOM;
checkBloom = false;
+ /*-
if (cleanerGlobalLock.tryLock()) {
System.out.println("Bloom filter for datastore
(" + name + ") missing/mismatch, rebuilding.");
try {
@@ -160,6 +161,7 @@
}
writeConfigFile();
}
+ */
}
cleanerThread.start();
Modified:
branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
2008-09-25 01:21:24 UTC (rev 22832)
+++ branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -44,6 +44,8 @@
@Override
public boolean equals(Object o) {
+ if (o == null)
+ return false;
if (o.getClass() != this.getClass())
return false;
T t = (T) o;
Copied:
branches/db4o/freenet/test/freenet/support/UpdatableSortedLinkedListTest.java
(from rev 22682,
trunk/freenet/test/freenet/support/UpdatableSortedLinkedListTest.java)
===================================================================
---
branches/db4o/freenet/test/freenet/support/UpdatableSortedLinkedListTest.java
(rev 0)
+++
branches/db4o/freenet/test/freenet/support/UpdatableSortedLinkedListTest.java
2008-09-25 01:24:43 UTC (rev 22833)
@@ -0,0 +1,87 @@
+package freenet.support;
+
+import junit.framework.TestCase;
+
+public class UpdatableSortedLinkedListTest extends TestCase {
+ private static class T extends UpdatableSortedLinkedListItemImpl {
+ private DoublyLinkedList parent;
+ private int value;
+
+ public T(int v) {
+ this.value = v;
+ }
+
+ public DoublyLinkedList getParent() {
+ return parent;
+ }
+
+ public DoublyLinkedList setParent(DoublyLinkedList l) {
+ DoublyLinkedList old = parent;
+ parent = l;
+ return old;
+ }
+
+ public int compareTo(Object o) {
+ T t = (T) o;
+ return t.value == value ? 0 : t.value > value ? -1 : 1;
+ }
+
+ void assertV(int v) {
+ assertEquals(v, value);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null)
+ return false;
+ if (o.getClass() != this.getClass())
+ return false;
+ T t = (T) o;
+ return t.value == value;
+ }
+
+ @Override
+ public int hashCode() {
+ return value;
+ }
+ }
+
+ public void testAdd1() throws UpdatableSortedLinkedListKilledException {
+ UpdatableSortedLinkedList l = new UpdatableSortedLinkedList();
+
+ assertTrue("isEmpty()", l.isEmpty());
+ assertEquals("size()", 0, l.size());
+ l.add(new T(2));
+ assertFalse("isEmpty()", l.isEmpty());
+ l.add(new T(5));
+ l.add(new T(-1));
+ l.add(new T(-5));
+ l.add(new T(3));
+ l.add(new T(0));
+ l.add(new T(1));
+ l.add(new T(-3));
+ l.add(new T(-2));
+ l.add(new T(4));
+ l.add(new T(-4));
+ assertEquals("size()", 11, l.size());
+
+ ((T) l.getLowest()).assertV(-5);
+ ((T) l.removeLowest()).assertV(-5);
+ assertFalse("isEmpty()", l.isEmpty());
+ assertEquals("size()", 10, l.size());
+ ((T) l.removeLowest()).assertV(-4);
+ ((T) l.removeLowest()).assertV(-3);
+ ((T) l.getLowest()).assertV(-2);
+ ((T) l.removeLowest()).assertV(-2);
+ ((T) l.removeLowest()).assertV(-1);
+ ((T) l.removeLowest()).assertV(0);
+ ((T) l.removeLowest()).assertV(1);
+ ((T) l.removeLowest()).assertV(2);
+ ((T) l.removeLowest()).assertV(3);
+ ((T) l.removeLowest()).assertV(4);
+ ((T) l.removeLowest()).assertV(5);
+ assertTrue("isEmpty()", l.isEmpty());
+ assertEquals("size()", 0, l.size());
+ }
+
+}