From 022c1ab1794e846075e542425844800bec763bcd Mon Sep 17 00:00:00 2001 From: allo Date: Fri, 2 Sep 2005 08:21:33 +0000 Subject: [PATCH] performance fix for yacyDebugMode and useYacyReferer. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@638 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpc.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java index b0cf142f8..f6bb423dc 100644 --- a/source/de/anomic/http/httpc.java +++ b/source/de/anomic/http/httpc.java @@ -131,11 +131,17 @@ public final class httpc { private String savedRemoteHost = null; private String requestPath = null; private boolean allowContentEncoding = true; + private static plasmaSwitchboard sb; + private static boolean useYacyReferer = true; + private static boolean yacyDebugMode = false; static { // set time-out of InetAddress.getByName cache ttl 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(); //serverLog.logDebug("HTTPC", handle + " initialized"); this.remoteProxyUse = false; - plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); this.timeout = timeout; - if(sb != null && sb.getConfig("yacyDebugMode", "false").equals("true")){ + if(sb != null && yacyDebugMode){ this.timeout=60000; } this.savedRemoteHost = server; @@ -559,8 +564,7 @@ public final class httpc { } // advertise a little bit... - plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); - if ( (!(header.containsKey(httpHeader.REFERER))) || (((String) header.get(httpHeader.REFERER)).trim().length() == 0)&& sb.getConfig("useYacyReferer", "true").equals("true") ) { + if ( (!(header.containsKey(httpHeader.REFERER))) || (((String) header.get(httpHeader.REFERER)).trim().length() == 0)&& useYacyReferer ) { header.put(httpHeader.REFERER, (((System.currentTimeMillis() >> 10) & 1) == 0) ? "http://www.anomic.de" :