LDAP: cache current hostname value in sendComputerContext to improve iCal address completion performance

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1465 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-20 21:30:15 +00:00
parent df4a6505c1
commit 007ae0b94f
1 changed files with 11 additions and 6 deletions

View File

@ -669,14 +669,19 @@ public class LdapConnection extends AbstractConnection {
}
}
protected String currentHostName;
protected String getCurrentHostName() throws UnknownHostException {
if (client.getInetAddress().isLoopbackAddress()) {
// local address, probably using localhost in iCal URL
return "localhost";
} else {
// remote address, send fully qualified domain name
return InetAddress.getLocalHost().getCanonicalHostName();
if (currentHostName == null) {
if (client.getInetAddress().isLoopbackAddress()) {
// local address, probably using localhost in iCal URL
currentHostName = "localhost";
} else {
// remote address, send fully qualified domain name
currentHostName = InetAddress.getLocalHost().getCanonicalHostName();
}
}
return currentHostName;
}
/**