more seedDB helpers

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4452 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
borg-0300 2008-02-06 12:32:41 +00:00
parent 6a85764e1a
commit 9ab6ad8b73

View File

@ -249,7 +249,7 @@ public final class yacyClient {
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
10000,
null,
null,
proxyConfig(),
@ -259,6 +259,7 @@ public final class yacyClient {
);
if (result == null || result.size() == 0) { return null; }
target.setLastSeenUTC();
//final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time
return yacySeed.genRemoteSeed((String) result.get("response"), post.get("key", ""), true);
} catch (Exception e) {
@ -279,7 +280,7 @@ public final class yacyClient {
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
10000,
null,
null,
proxyConfig(),
@ -289,7 +290,15 @@ public final class yacyClient {
);
if (result == null || result.size() == 0) { return -1; }
return Integer.parseInt((String) result.get("response"));
final String resp = (String) result.get("response");
if (resp == null) {
return -1;
} else try {
target.setLastSeenUTC();
return Integer.parseInt(resp);
} catch (NumberFormatException e) {
return -1;
}
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.queryRWICount error:" + e.getMessage());
return -1;
@ -311,7 +320,7 @@ public final class yacyClient {
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
6000,
10000,
null,
null,
proxyConfig(),
@ -325,6 +334,7 @@ public final class yacyClient {
if (resp == null) {
return -1;
} else try {
target.setLastSeenUTC();
return Integer.parseInt(resp);
} catch (NumberFormatException e) {
return -1;
@ -886,6 +896,9 @@ public final class yacyClient {
resultObj.put("result", "no_result_1");
return resultObj;
}
targetSeed.setLastSeenUTC();
if (!(result.equals("ok"))) {
targetSeed.setFlagAcceptRemoteIndex(false);
yacyCore.seedDB.update(targetSeed.hash, targetSeed);
@ -1073,7 +1086,7 @@ public final class yacyClient {
httpc.wput(
new yacyURL("http://" + address + "/yacy/profile.html", null),
targetSeed.getHexHash() + ".yacyh",
10000,
12000,
null,
null,
proxyConfig(),