performance fix for yacyDebugMode and useYacyReferer.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@638 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 20 years ago
parent 286442fbc5
commit 022c1ab179

@ -131,11 +131,17 @@ public final class httpc {
private String savedRemoteHost = null; private String savedRemoteHost = null;
private String requestPath = null; private String requestPath = null;
private boolean allowContentEncoding = true; private boolean allowContentEncoding = true;
private static plasmaSwitchboard sb;
private static boolean useYacyReferer = true;
private static boolean yacyDebugMode = false;
static { static {
// set time-out of InetAddress.getByName cache ttl // set time-out of InetAddress.getByName cache ttl
java.security.Security.setProperty("networkaddress.cache.ttl" , "60"); java.security.Security.setProperty("networkaddress.cache.ttl" , "60");
java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "0"); java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "0");
sb = plasmaSwitchboard.getSwitchboard();
useYacyReferer = sb.getConfig("useYacyReferer", "true").equals("true");
yacyDebugMode = sb.getConfig("yacyDebugMode", "false").equals("true");
} }
/** /**
@ -402,9 +408,8 @@ public final class httpc {
handle = System.currentTimeMillis(); handle = System.currentTimeMillis();
//serverLog.logDebug("HTTPC", handle + " initialized"); //serverLog.logDebug("HTTPC", handle + " initialized");
this.remoteProxyUse = false; this.remoteProxyUse = false;
plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
this.timeout = timeout; this.timeout = timeout;
if(sb != null && sb.getConfig("yacyDebugMode", "false").equals("true")){ if(sb != null && yacyDebugMode){
this.timeout=60000; this.timeout=60000;
} }
this.savedRemoteHost = server; this.savedRemoteHost = server;
@ -559,8 +564,7 @@ public final class httpc {
} }
// advertise a little bit... // advertise a little bit...
plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); if ( (!(header.containsKey(httpHeader.REFERER))) || (((String) header.get(httpHeader.REFERER)).trim().length() == 0)&& useYacyReferer ) {
if ( (!(header.containsKey(httpHeader.REFERER))) || (((String) header.get(httpHeader.REFERER)).trim().length() == 0)&& sb.getConfig("useYacyReferer", "true").equals("true") ) {
header.put(httpHeader.REFERER, header.put(httpHeader.REFERER,
(((System.currentTimeMillis() >> 10) & 1) == 0) ? (((System.currentTimeMillis() >> 10) & 1) == 0) ?
"http://www.anomic.de" : "http://www.anomic.de" :

Loading…
Cancel
Save