Implement a TODO: cache the list of MS TZ IDs
The MS TZ-backend's lookup of available Windows IDs included a TODO advocating caching the result, since it is unlikely to change at runtime. Given that MS's time_t functions don't believe in times before 1970 and two-digit year parsing (such as the ASN.1 parser does, apparently many times, during SSL handshakes) assumes the 1900s (and certs in use today have mostly been issued this century), SSL involves DTP falling back repeatedly to lookups of local time's offsets from UTC (before it discovers it shouldn't have been using local time anyway) via the system timezone object, this cacheable list can be accessed many times. (A user has reported thousands per SSL socket created.) So let's implement that TODO and trust that updates to the registry's set of available zones aren't a common occurrence at runtime. Pick-to: 6.5 Change-Id: Iefe235c71da1bf5c3372c52dba89ad0657e06c0b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d59e539b3a1252aa22783c4fdf1e22b35e5a4292) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
170d903a7e
commit
14f5eaaf58
@ -186,7 +186,7 @@ bool isSameRule(const QWinTimeZonePrivate::QWinTransitionRule &last,
|
||||
|
||||
QList<QByteArray> availableWindowsIds()
|
||||
{
|
||||
// TODO Consider caching results in a global static, very unlikely to change.
|
||||
static const QList<QByteArray> cache = [] {
|
||||
QList<QByteArray> list;
|
||||
QWinRegistryKey key(HKEY_LOCAL_MACHINE, tzRegPath);
|
||||
if (key.isValid()) {
|
||||
@ -202,6 +202,8 @@ QList<QByteArray> availableWindowsIds()
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}();
|
||||
return cache;
|
||||
}
|
||||
|
||||
QByteArray windowsSystemZoneId()
|
||||
|
Loading…
x
Reference in New Issue
Block a user