String physical[] = fs.getAll("physical.udp");
if(physical == null) {
// Leave it empty
} else {
for(String phys: physical) {
Peer p;
try {
p = new Peer(phys, true, true);
} catch(HostnameSyntaxException e) {
if(fromLocal)
Logger.error(this, "Invalid hostname or IP Address syntax error while parsing peer reference in local peers list: " + phys);
System.err.println("Invalid hostname or IP Address syntax error while parsing peer reference: " + phys);
continue;
} catch (PeerParseException e) {
if(fromLocal)
Logger.error(this, "Invalid hostname or IP Address syntax error while parsing peer reference in local peers list: " + phys);
System.err.println("Invalid hostname or IP Address syntax error while parsing peer reference: " + phys);
continue;
} catch (UnknownHostException e) {
if(fromLocal)
Logger.error(this, "Invalid hostname or IP Address syntax error while parsing peer reference in local peers list: " + phys);
System.err.println("Invalid hostname or IP Address syntax error while parsing peer reference: " + phys);
continue;
}
if(!nominalPeer.contains(p))
nominalPeer.add(p);
}
}
} catch(Exception e1) {
throw new FSParseException(e1);
}
if(nominalPeer.isEmpty()) {
Logger.normal(this, "No IP addresses found for identity '" + identityAsBase64String + "', possibly at location '" + location + ": " + userToString());
detectedPeer = null;
} else {
detectedPeer = nominalPeer.get(0);
}
updateShortToString();
// Don't create trackers until we have a key
currentTracker = null;
previousTracker = null;
timeLastSentPacket = -1;
timeLastReceivedPacket = -1;
timeLastReceivedSwapRequest = -1;
timeLastRoutable = -1;
timeAddedOrRestarted = System.currentTimeMillis();
swapRequestsInterval = new SimpleRunningAverage(50, Node.MIN_INTERVAL_BETWEEN_INCOMING_SWAP_REQUESTS);
probeRequestsInterval = new SimpleRunningAverage(50, Node.MIN_INTERVAL_BETWEEN_INCOMING_PROBE_REQUESTS);
messageQueue = new PeerMessageQueue();
decrementHTLAtMaximum = node.random.nextFloat() < Node.DECREMENT_AT_MAX_PROB;
decrementHTLAtMinimum = node.random.nextFloat() < Node.DECREMENT_AT_MIN_PROB;
pingNumber = node.random.nextLong();
// A SimpleRunningAverage would be a bad choice because it would cause oscillations.
// So go for a filter.
pingAverage =
// Short average otherwise we will reject for a *REALLY* long time after any spike.
new TimeDecayingRunningAverage(1, SECONDS.toMillis(30), 0, NodePinger.CRAZY_MAX_PING_TIME, node);
// TDRA for probability of rejection
pRejected =
new TimeDecayingRunningAverage(0, MINUTES.toMillis(4), 0.0, 1.0, node);
// ARK stuff.
parseARK(fs, true, false);
// Now for the metadata.
// The metadata sub-fieldset contains data about the node which is not part of the node reference.
// It belongs to this node, not to the node being described.
// Therefore, if we are parsing a remotely supplied ref, ignore it.
long now = System.currentTimeMillis();
if(fromLocal) {
SimpleFieldSet metadata = fs.subset("metadata");
if(metadata != null) {
location.setPeerLocations(fs.getAll("peersLocation"));
// Don't be tolerant of nonexistant domains; this should be an IP address.
Peer p;
try {
String detectedUDPString = metadata.get("detected.udp");
p = null;
if(detectedUDPString != null)
p = new Peer(detectedUDPString, false);
} catch(UnknownHostException e) {
p = null;
Logger.error(this, "detected.udp = " + metadata.get("detected.udp") + " - " + e, e);
} catch(PeerParseException e) {
p = null;