Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- update javadoc Seed.getIP - default mySeed.ip to hostip in SeedDB.initMySeed() if Intranetmode this allows to become senior status in intranet hosted search network with view peers, otherwise peer would stay junior because of default init with loopback ip as public (dna) ip.

regere31b0e6d672c
diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.java
index 8493d24ed..b7a31df9f 100644
--- a/source/net/yacy/peers/Seed.java
+++ b/source/net/yacy/peers/Seed.java
@@ -318,13 +318,13 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
}
/**
- * try to get the IP<br>
+ * try to get the public IP<br>
*
- * @return the IP or null
+ * @return the IP or localhost IP (127.0.0.1)
*/
public final String getIP() {
- final String ip = get(Seed.IP, Domains.LOCALHOST);
- return (ip == null || ip.isEmpty()) ? Domains.LOCALHOST : ip;
+ final String ip = this.dna.get(Seed.IP);
+ return (ip == null || ip.isEmpty()) ? Domains.LOCALHOST : ip; // not public (but leave as is for now 2014-08-24)
}
/**
diff --git a/source/net/yacy/peers/SeedDB.java b/source/net/yacy/peers/SeedDB.java
index 1a450a810..c932386f1 100644
--- a/source/net/yacy/peers/SeedDB.java
+++ b/source/net/yacy/peers/SeedDB.java
@@ -208,7 +208,11 @@ public final class SeedDB implements AlternativeDomainNames {
System.exit(-1);
}
}
- this.mySeed.setIP(""); // we delete the old information to see what we have now
+ if (Switchboard.getSwitchboard().isIntranetMode()) {
+ this.mySeed.setIP(Domains.myPublicLocalIP().getHostAddress()); // in intranet mode host address is best choice (to become senior peer)
+ } else {
+ this.mySeed.setIP("");// we delete the old information to see what we have now
+ }
this.mySeed.put(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN); // markup startup condition
}