- 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.
pull/1/head
reger 11 years ago
parent 350c6b8250
commit e31b0e6d67

@ -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)
}
/**

@ -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
}

Loading…
Cancel
Save