From e31b0e6d672c6e16b66a0e58648b7fe493455b57 Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 24 Aug 2014 21:13:36 +0200 Subject: [PATCH] - 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. --- source/net/yacy/peers/Seed.java | 8 ++++---- source/net/yacy/peers/SeedDB.java | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) 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, Comparator } /** - * try to get the IP
+ * try to get the public IP
* - * @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 }