1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

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

View File

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