|
|
|
@ -232,16 +232,9 @@ public final class yacyClient {
|
|
|
|
|
if (seedStr.length() > yacySeed.maxsize) {
|
|
|
|
|
yacyCore.log.logInfo("hello/client: rejected contacting seed; too large (" + seedStr.length() + " > " + yacySeed.maxsize + ")");
|
|
|
|
|
} else {
|
|
|
|
|
//System.out.println("DEBUG yacyClient.publishMySeed seedStr = " + seedStr);
|
|
|
|
|
yacySeed remoteSeed = yacySeed.genRemoteSeed(seedStr, post.get("key", ""), true);
|
|
|
|
|
if (remoteSeed == null) {
|
|
|
|
|
yacyCore.log.logWarning("hello/client: bad seed string from peer " + otherHash + ", address = " + address + ", count = " + (i-1) + " seedStr = " + seedStr);
|
|
|
|
|
} else {
|
|
|
|
|
if (yacyCore.peerActions.peerArrival(remoteSeed, (i == 1))) count++;
|
|
|
|
|
}
|
|
|
|
|
if (yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr, post.get("key", ""), true), (i == 1))) count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -256,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",
|
|
|
|
|
10000,
|
|
|
|
|
8000,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
proxyConfig(),
|
|
|
|
@ -266,8 +259,6 @@ public final class yacyClient {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (result == null || result.size() == 0) { return null; }
|
|
|
|
|
target.setFlagDirectConnect(true);
|
|
|
|
|
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) {
|
|
|
|
@ -288,7 +279,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",
|
|
|
|
|
10000,
|
|
|
|
|
8000,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
proxyConfig(),
|
|
|
|
@ -298,16 +289,7 @@ public final class yacyClient {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (result == null || result.size() == 0) { return -1; }
|
|
|
|
|
final String resp = (String) result.get("response");
|
|
|
|
|
if (resp == null) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else try {
|
|
|
|
|
target.setFlagDirectConnect(true);
|
|
|
|
|
target.setLastSeenUTC();
|
|
|
|
|
return Integer.parseInt(resp);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return Integer.parseInt((String) result.get("response"));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
yacyCore.log.logSevere("yacyClient.queryRWICount error:" + e.getMessage());
|
|
|
|
|
return -1;
|
|
|
|
@ -329,7 +311,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",
|
|
|
|
|
10000,
|
|
|
|
|
6000,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
proxyConfig(),
|
|
|
|
@ -343,8 +325,6 @@ public final class yacyClient {
|
|
|
|
|
if (resp == null) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else try {
|
|
|
|
|
target.setFlagDirectConnect(true);
|
|
|
|
|
target.setLastSeenUTC();
|
|
|
|
|
return Integer.parseInt(resp);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return -1;
|
|
|
|
@ -872,7 +852,7 @@ public final class yacyClient {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static HashMap<String, Object> transferIndex(yacySeed target, indexContainer[] indexes, HashMap<String, indexURLEntry> urlCache, boolean gzipBody, int timeout) {
|
|
|
|
|
public static HashMap<String, Object> transferIndex(yacySeed targetSeed, indexContainer[] indexes, HashMap<String, indexURLEntry> urlCache, boolean gzipBody, int timeout) {
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> resultObj = new HashMap<String, Object>();
|
|
|
|
|
int payloadSize = 0;
|
|
|
|
@ -892,7 +872,7 @@ public final class yacyClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// transfer the RWI without the URLs
|
|
|
|
|
HashMap<String, String> in = transferRWI(target, indexes, gzipBody, timeout);
|
|
|
|
|
HashMap<String, String> in = transferRWI(targetSeed, indexes, gzipBody, timeout);
|
|
|
|
|
resultObj.put("resultTransferRWI", in);
|
|
|
|
|
|
|
|
|
|
if (in == null) {
|
|
|
|
@ -906,10 +886,9 @@ public final class yacyClient {
|
|
|
|
|
resultObj.put("result", "no_result_1");
|
|
|
|
|
return resultObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(result.equals("ok"))) {
|
|
|
|
|
target.setFlagAcceptRemoteIndex(false);
|
|
|
|
|
yacyCore.seedDB.update(target.hash, target);
|
|
|
|
|
targetSeed.setFlagAcceptRemoteIndex(false);
|
|
|
|
|
yacyCore.seedDB.update(targetSeed.hash, targetSeed);
|
|
|
|
|
resultObj.put("result", result);
|
|
|
|
|
return resultObj;
|
|
|
|
|
}
|
|
|
|
@ -934,7 +913,7 @@ public final class yacyClient {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
in = transferURL(target, urls, gzipBody, timeout);
|
|
|
|
|
in = transferURL(targetSeed, urls, gzipBody, timeout);
|
|
|
|
|
resultObj.put("resultTransferURL", in);
|
|
|
|
|
|
|
|
|
|
if (in == null) {
|
|
|
|
@ -949,8 +928,8 @@ public final class yacyClient {
|
|
|
|
|
return resultObj;
|
|
|
|
|
}
|
|
|
|
|
if (!(result.equals("ok"))) {
|
|
|
|
|
target.setFlagAcceptRemoteIndex(false);
|
|
|
|
|
yacyCore.seedDB.update(target.hash, target);
|
|
|
|
|
targetSeed.setFlagAcceptRemoteIndex(false);
|
|
|
|
|
yacyCore.seedDB.update(targetSeed.hash, targetSeed);
|
|
|
|
|
resultObj.put("result",result);
|
|
|
|
|
return resultObj;
|
|
|
|
|
}
|
|
|
|
@ -1094,7 +1073,7 @@ public final class yacyClient {
|
|
|
|
|
httpc.wput(
|
|
|
|
|
new yacyURL("http://" + address + "/yacy/profile.html", null),
|
|
|
|
|
targetSeed.getHexHash() + ".yacyh",
|
|
|
|
|
12000,
|
|
|
|
|
10000,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
proxyConfig(),
|
|
|
|
|