Skip to content

Commit

Permalink
fixed div by zero, set default delays, fixed release number format an…
Browse files Browse the repository at this point in the history
…d display

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@435 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 26, 2005
1 parent 12da0c2 commit 3470a72
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 47 deletions.
16 changes: 16 additions & 0 deletions doc/News.html
Expand Up @@ -43,6 +43,22 @@ <h2>News</h2>
</ul>
-->

<!--
<br><p>v0.391_20050726_424 (bugfix release)
<ul>
<li>Fixed division by zero on IndexCreate-page</li>
<li>Forcing delays of at least 100 milliseconds on Performance-page to prevent DoS behavior</li>
<li>Fixed release number display</li>
<li>Fixed name-entry bug on Settings-page</li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
-->

<br><p>v0.39_20050722_424
<ul>
<li>New Features:</li>
Expand Down
4 changes: 4 additions & 0 deletions htroot/IndexCreate_p.java
Expand Up @@ -269,6 +269,10 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("localIndexingChecked", env.getConfig("localIndexing", "").equals("true") ? 1 : 0);
prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? 1 : 0);
long busySleep = Integer.parseInt(env.getConfig("62_remotetriggeredcrawl_busysleep", "100"));
if (busySleep < 100) {
busySleep = 100;
env.setConfig("62_remotetriggeredcrawl_busysleep", "" + busySleep);
}
if (env.getConfig("crawlResponse", "").equals("true")) {
if (busySleep <= 100) {
prop.put("acceptCrawlMaxChecked", 1);
Expand Down
4 changes: 2 additions & 2 deletions htroot/Network.html
Expand Up @@ -46,9 +46,9 @@ <h2>Manually contacting Peer</h2>
<td class="small">Hash<br>&nbsp;</td>
#(/complete)#
<td class="small">Type<br>&nbsp;</td>
<td class="small">Version<br>&nbsp;</td>
<td class="small">Version<br>Rel/SVN<br>&nbsp;</td>
<td class="small">Contact<br>&nbsp;</td>
<td class="small">Last Seen<br>#min ago<br>&nbsp;<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">&gt;</a></td>
<td class="small">Last Seen<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">&gt;</a></td>
<td class="small">Uptime<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=Uptime&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=Uptime&order=down">&gt;</a></td>
<td class="small">#Links<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LCount&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LCount&order=down">&gt;</a></td>
<td class="small">#RWIs<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=ICount&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=ICount&order=down">&gt;</a></td>
Expand Down
4 changes: 2 additions & 2 deletions htroot/Network.java
Expand Up @@ -193,7 +193,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
// generate table
int page = Integer.parseInt(post.get("page", "1"));
int conCount = 0;
int maxCount = 100;
int maxCount = 500;
if (yacyCore.seedDB == null) {
prop.put("table", 0);//no remote senior/principal proxies known"
} else {
Expand Down Expand Up @@ -256,7 +256,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("table_list_"+conCount+"_type", 2);
prop.put("table_list_"+conCount+"_type_url", seed.get("seedURL", "http://nowhere/") );
}
prop.put("table_list_"+conCount+"_version", seed.get("Version", "-"));
prop.put("table_list_"+conCount+"_version", yacy.combinedVersionString2PrettyString(seed.get("Version", "0.1")));
prop.put("table_list_"+conCount+"_contact", (seed.getFlagDirectConnect() ? 1 : 0) );
prop.put("table_list_"+conCount+"_lastSeen", lastSeen(seed.get("LastSeen", "-")) );
prop.put("table_list_"+conCount+"_uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get("Uptime", "0"))));
Expand Down
6 changes: 5 additions & 1 deletion htroot/Performance_p.java
Expand Up @@ -145,7 +145,11 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
// check values to prevent short-cut loops
if (idlesleep < 1000) idlesleep = 1000;
if (threadName.equals("10_httpd")) { idlesleep = 0; busysleep = 0; memprereq = 0; }

if ((threadName.equals("50_localcrawl")) && (busysleep < 100)) busysleep = 100;
if ((threadName.equals("61_globalcrawltrigger")) && (busysleep < 100)) busysleep = 100;
if ((threadName.equals("62_remotetriggeredcrawl")) && (busysleep < 100)) busysleep = 100;


// on-the-fly re-configuration
switchboard.setThreadPerformance(threadName, idlesleep, busysleep, memprereq);
switchboard.setConfig(threadName + "_idlesleep", idlesleep);
Expand Down
5 changes: 3 additions & 2 deletions htroot/SettingsAck_p.java
Expand Up @@ -297,8 +297,9 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

// check if peer name already exists
String peerName = (String) post.get("peername");
String staticIP = (String)post.get("staticIP");
env.setConfig("staticIP", staticIP);
String staticIP = (String)post.get("staticIP");
env.setConfig("staticIP", staticIP);
if (staticIP.length() > 0) yacyCore.seedDB.mySeed.put("IP", staticIP);
yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName);

if ((oldSeed == null) || (env.getConfig("peerName","").equals(peerName))) {
Expand Down
14 changes: 10 additions & 4 deletions htroot/Settings_p.html
Expand Up @@ -70,14 +70,20 @@ <h2>Settings</h2>
<tr valign="top">
<td>Peer&nbsp;Name:</td>
<td><input name="peername" type="text" size="32" maxlength="80" value="#[peerName]#"></td>
<td><b>Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy.
Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.</b><br>
<td><b>Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy.</b>
Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.<br>
<i>(hint: Choose a name that appears on a web page that tells something about you, visit the page, get the 'senior' status, and you can be found...)</i></td>
</tr>
<tr valign="top">
<td>staticIP(optional):</td>
<td>staticIP (optional):</td>
<td><input name="staticIP" type="text" size="32" maxlength="80" value="#[staticIP]#"></td>
<td><b>If you have a static IP or a dyndns Account, enter it here to shorten the bootstrapping.</b><br>
<td><b>The staticIP can help that your peer can be reached by other peers in case that your
peer is behind a firewall or proxy.</b> You can create a tunnel through the firewall/proxy
(look out for 'tunneling through https proxy with connect command') and create
an access point for incoming connections.
This access address can be set here (either as IP number or domain name).
If the address of outgoing connections is equal to the address of incoming connections,
you don't need to set anything here, please leave it blank.<br>
</tr>
<tr>
<td colspan="3"><input type="submit" name="generalsettings" value="submit"></td>
Expand Down
2 changes: 1 addition & 1 deletion htroot/Status.html
Expand Up @@ -34,7 +34,7 @@ <h2>System-, Index- and Peer-Status</h2>
#(/protection)#
</td></tr>
<tr class="TableCellLight"><td>System version</td><td>
#[version]# (SVN #[svnRevision]#)#(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#
#[versionpp]# #(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#
</td></tr>
<tr class="TableCellDark"><td>Proxy host</td><td>#[host]#:#[port]#</td></tr>
<tr class="TableCellLight"><td>Port forwarding host</td><td>#(portForwarding)#not used::#[host]#:#[port]# (#(status)#broken::connected#(/status)#)#(/portForwarding)#</td></tr>
Expand Down
7 changes: 3 additions & 4 deletions htroot/Status.java
Expand Up @@ -80,11 +80,10 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("protection", 1);//protected

// version information
prop.put("svnRevision", env.getConfig("svnRevision", ""));
double thisVersion = Float.parseFloat(env.getConfig("version","0.1"));
prop.put("versionpp", yacy.combinedVersionString2PrettyString(env.getConfig("version","0.1")));
double thisVersion = Double.parseDouble(env.getConfig("version","0.1"));
//cut off the SVN Rev in the Version
try {thisVersion = Math.round(thisVersion*100.0)/100.0;} catch (NumberFormatException e) {}
prop.put("version", thisVersion.toString()); //???
try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}
//System.out.println("TEST: "+thisVersion);
if (yacyCore.latestVersion >= (thisVersion+0.01)) //only new Versions(not new SVN)
prop.put("versioncomment", 1);//new version
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/data/translator.java
Expand Up @@ -71,7 +71,7 @@ public static String translate(String source, Hashtable translationList){
while(keys.hasMoreElements()){
key = (String)keys.nextElement();
result = result.replaceAll(key, (String)translationList.get(key));
//yacyCore.log.logDebug("Replaced \""+key+"\" by \""+translationList.getProperty(key)+"\""); //DEBUG
//System.out.println("Replaced \""+key+"\" by \""+translationList.getProperty(key)+"\""); //DEBUG
}
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions source/de/anomic/data/wikiBoard.java
Expand Up @@ -146,7 +146,7 @@ record = new HashMap();
else
record.put("page", serverCodings.enhancedCoder.encodeBase64(page));
authors.put(ip, author);
//yacyCore.log.logDebug("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
//System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
}

private entry(String key, Map record) {
Expand Down Expand Up @@ -259,9 +259,9 @@ public String write(entry page) {
page.setAncestorDate(oldDate);
oldEntry.setChild(page.subject());
// write the backup
//yacyCore.log.logDebug("key = " + page.key);
//yacyCore.log.logDebug("oldDate = " + oldDate);
//yacyCore.log.logDebug("record = " + oldEntry.record.toString());
//System.out.println("key = " + page.key);
//System.out.println("oldDate = " + oldDate);
//System.out.println("record = " + oldEntry.record.toString());
bkpbase.set(page.key + dateString(oldDate), oldEntry.record);
// write the new page
datbase.set(page.key, page.record);
Expand Down
16 changes: 8 additions & 8 deletions source/de/anomic/htmlFilter/htmlFilterContentScraper.java
Expand Up @@ -96,7 +96,7 @@ public htmlFilterContentScraper(URL root) {
}

public void scrapeText(byte[] newtext) {
//yacyCore.log.logDebug("SCRAPE: " + new String(newtext));
//System.out.println("SCRAPE: " + new String(newtext));
if ((text.length() != 0) && (text.byteAt(text.length() - 1) != 32)) text.append(32);
text.append(super.stripAll(new serverByteBuffer(newtext, newtext.length + 1)).trim()).append(32);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public void scrapeTag0(String tagname, Properties tagopts) {
}

public void scrapeTag1(String tagname, Properties tagopts, byte[] text) {
//yacyCore.log.logDebug("ScrapeTag1: tagname=" + tagname + ", opts=" + tagopts.toString() + ", text=" + new String(text));
//System.out.println("ScrapeTag1: tagname=" + tagname + ", opts=" + tagopts.toString() + ", text=" + new String(text));
if ((tagname.equalsIgnoreCase("a")) && (text.length < 2048)) anchors.put(absolutePath(tagopts.getProperty("href", "")), super.stripAll(new serverByteBuffer(text)).trim().toString());
if ((tagname.equalsIgnoreCase("h1")) && (text.length < 1024)) headline = super.stripAll(new serverByteBuffer(text)).toString();
if ((tagname.equalsIgnoreCase("title")) && (text.length < 1024)) title = super.stripAll(new serverByteBuffer(text)).toString();
Expand Down Expand Up @@ -181,11 +181,11 @@ public void close() {
}

public void print() {
yacyCore.log.logInfo("TITLE :" + title);
yacyCore.log.logInfo("HEADLINE:" + headline);
yacyCore.log.logInfo("ANCHORS :" + anchors.toString());
yacyCore.log.logInfo("IMAGES :" + images.toString());
yacyCore.log.logInfo("TEXT :" + new String(text.getBytes()));
System.out.println("TITLE :" + title);
System.out.println("HEADLINE:" + headline);
System.out.println("ANCHORS :" + anchors.toString());
System.out.println("IMAGES :" + images.toString());
System.out.println("TEXT :" + new String(text.getBytes()));
}


Expand All @@ -194,7 +194,7 @@ public static void main(String[] args) {
try {
htmlFilterContentScraper scraper = new htmlFilterContentScraper(new URL("http://localhost"));
scraper.scrapeText(test.getBytes());
yacyCore.log.logInfo(new String(scraper.getText()));
System.out.println(new String(scraper.getText()));
} catch (MalformedURLException e) {}
}

Expand Down
6 changes: 3 additions & 3 deletions source/de/anomic/htmlFilter/htmlFilterContentTransformer.java
Expand Up @@ -77,7 +77,7 @@ public htmlFilterContentTransformer() {
}

public void init(String initarg) {
//yacyCore.log.logDebug("Transformer init: " + initarg);
//System.out.println("Transformer init: " + initarg);
if (bluelist == null) {
// here, the initarg is used to load a list of bluelisted words
bluelist = new Vector();
Expand All @@ -91,7 +91,7 @@ public void init(String initarg) {
r.close();
} catch (Exception e) {
}
//if (bluelist.size() == 0) yacyCore.log.logInfo("BLUELIST is empty");
//if (bluelist.size() == 0) System.out.println("BLUELIST is empty");
}
}

Expand All @@ -117,7 +117,7 @@ private boolean hit(byte[] text) {

public byte[] transformText(byte[] text) {
if (hit(text)) {
yacyCore.log.logInfo("FILTERHIT: " + text);
//System.out.println("FILTERHIT: " + text);
return genBlueLetters(text.length);
} else
return text;
Expand Down
10 changes: 5 additions & 5 deletions source/de/anomic/htmlFilter/htmlFilterOutputStream.java
Expand Up @@ -159,7 +159,7 @@ public static byte[] genOpts(Properties prop, byte quotechar) {
}

private byte[] filterTag(String tag, boolean opening, byte[] content, byte quotechar) {
//yacyCore.log.logDebug("FILTER1: filterTag=" + ((filterTag == null) ? "null" : filterTag) + ", tag=" + tag + ", opening=" + ((opening) ? "true" : "false") + ", content=" + new String(content)); // debug
//System.out.println("FILTER1: filterTag=" + ((filterTag == null) ? "null" : filterTag) + ", tag=" + tag + ", opening=" + ((opening) ? "true" : "false") + ", content=" + new String(content)); // debug
if (filterTag == null) {
// we are not collection tag text
if (tag == null) {
Expand Down Expand Up @@ -245,7 +245,7 @@ private byte[] filterFinalize(byte quotechar) {

private byte[] filterSentence(byte[] in, byte quotechar) {
if (in.length == 0) return in;
//yacyCore.log.logDebug("FILTER0: " + new String(in)); // debug
//System.out.println("FILTER0: " + new String(in)); // debug
// scan the string and parse structure
if ((in.length > 2) && (in[0] == lb)) {
// a tag
Expand Down Expand Up @@ -290,7 +290,7 @@ public void write(int b) throws IOException {
}

private void write(byte b) throws IOException {
//yacyCore.log.logDebug((char) b);
//System.out.println((char) b);
if ((binaryUnsuspect) && (binaryHint(b))) {
binaryUnsuspect = false;
if (passbyIfBinarySuspect) finalize();
Expand Down Expand Up @@ -423,7 +423,7 @@ public void write(byte b[]) throws IOException {
}

public void write(byte b[], int off, int len) throws IOException {
//yacyCore.log.logDebug(new String(b, off, len));
//System.out.println(new String(b, off, len));
if ((off | len | (b.length - (len + off)) | (off + len)) < 0) throw new IndexOutOfBoundsException();
for (int i = off ; i < (len - off) ; i++) this.write(b[i]);
}
Expand Down Expand Up @@ -469,7 +469,7 @@ private static boolean binaryHint(byte b) {
if (b > 31) return false;
if ((b == 8) || (b == 9) || (b == 10) || (b == 13)) return false;
//return false;
yacyCore.log.logInfo("BINARY HINT: " + (int) b);
//System.out.println("BINARY HINT: " + (int) b);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/kelondro/kelondroRecords.java
Expand Up @@ -105,7 +105,7 @@ public class kelondroRecords {
// POS_NODES : (USEDC + FREEC) * (overhead + sum(all: COLWIDTHS)) : Node Objects

// values that are only present at run-time
protected String filename; // the database's file name
protected String filename; // the database's file name
protected kelondroRA entryFile; // the database file
private int overhead; // OHBYTEC + 4 * OHHANDLEC = size of additional control bytes
private int recordsize; // (overhead + sum(all: COLWIDTHS)) = the overall size of a record
Expand Down
12 changes: 7 additions & 5 deletions source/de/anomic/plasma/plasmaHTCache.java
Expand Up @@ -181,17 +181,19 @@ public boolean writeFile(URL url, byte[] array) {
}

public void writeFileAnnouncement(File file) {
if (file.exists()) {
currCacheSize += file.length();
cacheAge.put(ageString(file.lastModified(), file), file);
cleanup();
synchronized (cacheAge) {
if (file.exists()) {
currCacheSize += file.length();
cacheAge.put(ageString(file.lastModified(), file), file);
cleanup();
}
}
}

private void cleanup() {
// clean up cache to have enough space for next entries
File f;
while (currCacheSize > maxCacheSize) {
while ((currCacheSize > maxCacheSize) && (cacheAge.size() > 0)) {
f = (File) cacheAge.remove(cacheAge.firstKey());
if ((f != null) && (f.exists())) {
currCacheSize -= f.length();
Expand Down

0 comments on commit 3470a72

Please sign in to comment.