Skip to content

Commit

Permalink
removed yacy peer types from serverSwitch
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@758 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Sep 20, 2005
1 parent b990dc1 commit 96a5b6e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
5 changes: 3 additions & 2 deletions htroot/htdocsdefault/welcome.java
Expand Up @@ -53,6 +53,7 @@
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed;

public class welcome {

Expand All @@ -75,8 +76,8 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("port", env.getConfig("port", "8080"));
prop.put("clientip", header.get("CLIENTIP", ""));

final String peertype = (yacyCore.seedDB.mySeed == null) ? serverSwitch.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(serverSwitch.PEERTYPE_SENIOR)) || (peertype.equals(serverSwitch.PEERTYPE_PRINCIPAL));
final String peertype = (yacyCore.seedDB.mySeed == null) ? yacySeed.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }
if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.put("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }
prop.put("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
Expand Down
20 changes: 10 additions & 10 deletions htroot/yacy/hello.java
Expand Up @@ -92,7 +92,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
// we easily know the caller's IP:
final String clientip = (String) header.get("CLIENTIP", "<unknown>"); // read an artificial header addendum
final String reportedip = remoteSeed.get(STR_IP, "");
final String reportedPeerType = remoteSeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_JUNIOR);
final String reportedPeerType = remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
final float clientversion = remoteSeed.getVersion();

int urls = -1;
Expand Down Expand Up @@ -139,22 +139,22 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

// assign status
if (urls >= 0) {
if (remoteSeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_SENIOR) == null) {
prop.put(STR_YOURTYPE, serverSwitch.PEERTYPE_SENIOR);
remoteSeed.put(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_SENIOR);
} else if (remoteSeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_PRINCIPAL).equals(serverSwitch.PEERTYPE_PRINCIPAL)) {
prop.put(STR_YOURTYPE, serverSwitch.PEERTYPE_PRINCIPAL);
if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) == null) {
prop.put(STR_YOURTYPE, yacySeed.PEERTYPE_SENIOR);
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
} else if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL).equals(yacySeed.PEERTYPE_PRINCIPAL)) {
prop.put(STR_YOURTYPE, yacySeed.PEERTYPE_PRINCIPAL);
} else {
prop.put(STR_YOURTYPE, serverSwitch.PEERTYPE_SENIOR);
remoteSeed.put(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_SENIOR);
prop.put(STR_YOURTYPE, yacySeed.PEERTYPE_SENIOR);
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
}
// connect the seed
yacyCore.peerActions.peerArrival(remoteSeed, true);
} else {
prop.put(STR_YOURTYPE, serverSwitch.PEERTYPE_JUNIOR);
prop.put(STR_YOURTYPE, yacySeed.PEERTYPE_JUNIOR);
remoteSeed.put(STR_LASTSEEN, yacyCore.universalDateShortString());
yacyCore.peerActions.juniorConnects++; // update statistics
remoteSeed.put(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_JUNIOR);
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);
// no connection here, instead store junior in connection cache
if ((remoteSeed.hash != null) && (remoteSeed.isProper() == null)) {
Expand Down
6 changes: 0 additions & 6 deletions source/de/anomic/server/serverSwitch.java
Expand Up @@ -55,12 +55,6 @@ this is an interface for possible switchboard implementations

public interface serverSwitch {

public static final String PEERTYPE = "PeerType";
public static final String PEERTYPE_VIRGIN = "virgin";
public static final String PEERTYPE_JUNIOR = "junior";
public static final String PEERTYPE_SENIOR = "senior";
public static final String PEERTYPE_PRINCIPAL = "principal";

// the root path for the application
public String getRootPath();

Expand Down
1 change: 0 additions & 1 deletion source/de/anomic/yacy/yacySeed.java
Expand Up @@ -82,7 +82,6 @@ public class yacySeed {
public static final String PEERTYPE_JUNIOR = "junior";
public static final String PEERTYPE_SENIOR = "senior";
public static final String PEERTYPE_PRINCIPAL = "principal";

public static final String PEERTYPE = "PeerType";

// class variables
Expand Down
10 changes: 5 additions & 5 deletions yacy.init
Expand Up @@ -437,23 +437,23 @@ xpstopw=true

# ram cache for database files

# ram cache for assortment cache cluster (for all 50 files)
# ram cache for assortment cache cluster (for all 64 files)
ramCacheRWI = 8388608

# ram cache for responseHeader.db
ramCacheHTTP = 1048576
ramCacheHTTP = 4194304

# ram cache for urlHash.db
ramCacheLURL = 4194304

# ram cache for urlNotice.db
ramCacheNURL = 524288
ramCacheNURL = 4194304

# ram cache for urlErr.db
ramCacheEURL = 131072
ramCacheEURL = 8192

# ram cache for seedDBs
ramCacheDHT = 131072
ramCacheDHT = 8192

# ram cache for message.db
ramCacheMessage = 8192
Expand Down

0 comments on commit 96a5b6e

Please sign in to comment.