|
|
|
@ -3632,12 +3632,12 @@ public final class Switchboard extends serverSwitch {
|
|
|
|
|
}
|
|
|
|
|
c++;
|
|
|
|
|
if ( seedListFileURL.startsWith("http://") || seedListFileURL.startsWith("https://") ) {
|
|
|
|
|
loadSeedListConcurrently(this.peers, seedListFileURL, scc, (int) getConfigLong("bootstrapLoadTimeout", 20000));
|
|
|
|
|
loadSeedListConcurrently(this.peers, seedListFileURL, scc, (int) getConfigLong("bootstrapLoadTimeout", 20000), c > 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void loadSeedListConcurrently(final SeedDB peers, final String seedListFileURL, final AtomicInteger scc, final int timeout) {
|
|
|
|
|
private static void loadSeedListConcurrently(final SeedDB peers, final String seedListFileURL, final AtomicInteger scc, final int timeout, final boolean checkAge) {
|
|
|
|
|
// uses the superseed to initialize the database with known seeds
|
|
|
|
|
|
|
|
|
|
Thread seedLoader = new Thread() {
|
|
|
|
@ -3656,24 +3656,21 @@ public final class Switchboard extends serverSwitch {
|
|
|
|
|
client.HEADResponse(url.toString());
|
|
|
|
|
int statusCode = client.getHttpResponse().getStatusLine().getStatusCode();
|
|
|
|
|
ResponseHeader header = new ResponseHeader(statusCode, client.getHttpResponse().getAllHeaders());
|
|
|
|
|
//final long loadtime = System.currentTimeMillis() - start;
|
|
|
|
|
/*if (header == null) {
|
|
|
|
|
if (loadtime > getConfigLong("bootstrapLoadTimeout", 6000)) {
|
|
|
|
|
yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, time-out after " + loadtime + " milliseconds");
|
|
|
|
|
} else {
|
|
|
|
|
yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, no content");
|
|
|
|
|
}
|
|
|
|
|
} else*/if ( header.lastModified() == null ) {
|
|
|
|
|
if (checkAge) {
|
|
|
|
|
if ( header.lastModified() == null ) {
|
|
|
|
|
Network.log.warn("BOOTSTRAP: seed-list URL "
|
|
|
|
|
+ seedListFileURL
|
|
|
|
|
+ " not usable, last-modified is missing");
|
|
|
|
|
return;
|
|
|
|
|
} else if ( (header.age() > 86400000) && (scc.get() > 0) ) {
|
|
|
|
|
Network.log.info("BOOTSTRAP: seed-list URL "
|
|
|
|
|
+ seedListFileURL
|
|
|
|
|
+ " too old ("
|
|
|
|
|
+ (header.age() / 86400000)
|
|
|
|
|
+ " days)");
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
scc.incrementAndGet();
|
|
|
|
|
final byte[] content = client.GETbytes(url);
|
|
|
|
|
Iterator<String> enu = FileUtils.strings(content);
|
|
|
|
@ -3701,7 +3698,6 @@ public final class Switchboard extends serverSwitch {
|
|
|
|
|
+ ", AGE="
|
|
|
|
|
+ (header.age() / 3600000)
|
|
|
|
|
+ "h");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (final IOException e ) {
|
|
|
|
|
// this is when wget fails, commonly because of timeout
|
|
|
|
|