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