Author: toad
Date: 2008-04-10 14:28:55 +0000 (Thu, 10 Apr 2008)
New Revision: 19138

Modified:
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/Announcer.java
Log:
When there are 10 TOO_OLD peers, and updating is either waiting for user input 
or is completely disabled, turn off announcement (to avoid spamming the 
seednodes forever), and warn the user.

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-10 
14:05:25 UTC (rev 19137)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-10 
14:28:55 UTC (rev 19138)
@@ -4,6 +4,8 @@
 Announcer.announceDetails=We have recently sent ${recentSentAnnouncements} 
announcements, ${runningAnnouncements} of which are still running, and added 
${addedNodes} nodes (${refusedNodes} nodes have rejected us). We are currently 
connected to ${connectedSeednodes} seednodes and trying to connect to another 
${disconnectedSeednodes}.
 Announcer.announceAlertNoSeednodes=There is no seednodes.fref file found, so 
the node will not be able to automatically bootstrap itself onto the opennet. 
Please add some nodes manually, or download the seednodes file from 
http://downloads.freenetproject.org/alpha/opennet/ .
 Announcer.announceLoading=Freenet is currently loading the seednodes file so 
that it can attempt to announce to the rest of the network. Announcement may 
take a few minutes.
+Announcer.announceDisabledTooOldTitle=Announcement disabled (too old)
+Announcer.announceDisabledTooOld=This node appears to be too old to connect to 
the current Freenet network. We have disabled announcement, since it is not 
getting anywhere. Please update your node as soon as possible (auto-updating 
may be waiting for input or it may be disabled).
 Announcer.coolingOff=For the next ${time} seconds, the node is waiting for the 
nodes that it just announced to to connect, if there are not enough nodes it 
will try a different node.
 BookmarkEditorToadlet.addBookmark=Add Bookmark
 BookmarkEditorToadlet.addCategory=Add Category

Modified: trunk/freenet/src/freenet/node/Announcer.java
===================================================================
--- trunk/freenet/src/freenet/node/Announcer.java       2008-04-10 14:05:25 UTC 
(rev 19137)
+++ trunk/freenet/src/freenet/node/Announcer.java       2008-04-10 14:28:55 UTC 
(rev 19138)
@@ -17,6 +17,7 @@
 import freenet.io.comm.PeerParseException;
 import freenet.io.comm.ReferenceSignatureVerificationException;
 import freenet.l10n.L10n;
+import freenet.node.useralerts.SimpleUserAlert;
 import freenet.node.useralerts.UserAlert;
 import freenet.support.ByteArrayWrapper;
 import freenet.support.HTMLNode;
@@ -258,6 +259,19 @@
                        }
                        return true;
                }
+               if(node.nodeUpdater == null || (!node.nodeUpdater.isEnabled()) 
|| 
+                               node.nodeUpdater.canUpdateNow()) {
+                       // If we also have 10 TOO_NEW peers, we should shut 
down the announcement,
+                       // because we're obviously broken and would only be 
spamming the seednodes.
+                       
if(node.peers.getPeerNodeStatusSize(PeerManager.PEER_NODE_STATUS_TOO_NEW, true) 
+
+                                       
node.peers.getPeerNodeStatusSize(PeerManager.PEER_NODE_STATUS_TOO_NEW, false) > 
10) {
+                               Logger.error(this, "Shutting down announcement 
as we are older than the current mandatory build and auto-update is disabled or 
waiting for user input.");
+                               System.err.println("Shutting down announcement 
as we are older than the current mandatory build and auto-update is disabled or 
waiting for user input.");
+                               if(node.clientCore != null)
+                                       node.clientCore.alerts.register(new 
SimpleUserAlert(false, l10n("announceDisabledTooOldTitle"), 
l10n("announceDisabledTooOld"), UserAlert.CRITICAL_ERROR));
+                       }
+                               
+               }
                synchronized(this) {
                        timeGotEnoughPeers = -1;
                }


Reply via email to