Author: toad
Date: 2007-08-07 15:44:58 +0000 (Tue, 07 Aug 2007)
New Revision: 14509
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Make location optional in noderefs
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2007-08-07 15:40:31 UTC
(rev 14508)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2007-08-07 15:44:58 UTC
(rev 14509)
@@ -340,7 +340,12 @@
version = fs.get("version");
Version.seenVersion(version);
String locationString = fs.get("location");
- currentLocation = Location.getLocation(locationString);
+ try {
+ currentLocation = Location.getLocation(locationString);
+ } catch (FSParseException e) {
+ // Wait for them to send us an FNPLocChangeNotification
+ currentLocation = -1.0;
+ }
// FIXME make mandatory once everyone has upgraded
lastGoodVersion = fs.get("lastGoodVersion");
@@ -837,7 +842,8 @@
* PeerManager in e.g. verified.
*/
public boolean isRoutable() {
- return isConnected() && isRoutingCompatible();
+ return isConnected() && isRoutingCompatible() &&
+ !(currentLocation < 0.0 || currentLocation > 1.0);
}
public boolean isRoutingCompatible(){
@@ -1717,10 +1723,16 @@
if(!forARK)
throw new FSParseException("No location");
} else {
- double newLoc = Location.getLocation(locationString);
- if(!Location.equals(newLoc, currentLocation)) {
- changedAnything = true;
- currentLocation = newLoc;
+ try {
+ double newLoc = Location.getLocation(locationString);
+ if(!Location.equals(newLoc, currentLocation)) {
+ changedAnything = true;
+ currentLocation = newLoc;
+ }
+ } catch (FSParseException e) {
+ // Location is optional, we will wait for
FNPLocChangeNotification
+ if(logMINOR)
+ Logger.minor(this, "Invalid or null location,
waiting for FNPLocChangeNotification: "+e);
}
}