mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- bugfix in ServerScannerList
- speed up of generation of scanner list avoiding forced dns lookup git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7871 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
8e03b8ee8b
commit
f970670a7c
|
@ -42,8 +42,8 @@ public class ServerScannerList {
|
|||
final serverObjects prop = new serverObjects();
|
||||
final Switchboard sb = (Switchboard)env;
|
||||
|
||||
prop.put("servertable_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);
|
||||
prop.put("servertable_list_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);
|
||||
boolean edit = post != null && post.containsKey("edit");
|
||||
prop.put("servertable_edit", edit ? 1 : 0);
|
||||
prop.put("embedded", post == null ? 0 : post.containsKey("embedded") ? 1 : 0);
|
||||
prop.put("servertable", 0);
|
||||
|
||||
|
@ -66,6 +66,7 @@ public class ServerScannerList {
|
|||
try {
|
||||
u = new DigestURI(host.getKey().url());
|
||||
urlString = u.toNormalform(true, false);
|
||||
prop.put("servertable_list_" + i + "_edit", edit ? 1 : 0);
|
||||
prop.put("servertable_list_" + i + "_edit_pk", ASCII.String(u.hash()));
|
||||
prop.put("servertable_list_" + i + "_edit_count", i);
|
||||
prop.putHTML("servertable_list_" + i + "_protocol", u.getProtocol());
|
||||
|
|
|
@ -522,7 +522,18 @@ public class Domains {
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* in case that the host name was resolved using a time-out request
|
||||
* it can be nice to push that information to the name cache
|
||||
* @param i the inet address
|
||||
* @param host the known host name
|
||||
*/
|
||||
public static void setHostName(final InetAddress i, String host) {
|
||||
NAME_CACHE_HIT.insertIfAbsent(host, i);
|
||||
cacheHit_Insert++;
|
||||
}
|
||||
|
||||
public static InetAddress dnsResolve(String host) {
|
||||
if ((host == null) || (host.length() == 0)) return null;
|
||||
host = host.toLowerCase().trim();
|
||||
|
|
|
@ -80,8 +80,22 @@ public class Scanner extends Thread {
|
|||
return this.inetAddress;
|
||||
}
|
||||
public String getHostName() {
|
||||
if (this.hostname != null) return this.hostname;
|
||||
this.hostname = Domains.getHostName(this.inetAddress);
|
||||
if (this.hostname != null) {
|
||||
if (this.hostname.equals(this.inetAddress.getHostAddress())) {
|
||||
// if the hostname was created in case of a time-out from TimoutRequest
|
||||
// then in rare cases we try to get that name again
|
||||
if ( (System.currentTimeMillis() / 1000) % 10 != 1) return this.hostname;
|
||||
} else {
|
||||
return this.hostname;
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.hostname = TimeoutRequest.getHostName(this.inetAddress, 100);
|
||||
Domains.setHostName(this.inetAddress, this.hostname);
|
||||
} catch (ExecutionException e) {
|
||||
this.hostname = this.inetAddress.getHostAddress();
|
||||
}
|
||||
//this.hostname = Domains.getHostName(this.inetAddress);
|
||||
return this.hostname;
|
||||
}
|
||||
public MultiProtocolURI url() throws MalformedURLException {
|
||||
|
|
Loading…
Reference in New Issue
Block a user