2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Use crl::time/now instead of TimeMs/getms.

This commit is contained in:
John Preston
2019-02-19 10:57:53 +04:00
parent d208236994
commit fe618bd652
310 changed files with 1133 additions and 1141 deletions

View File

@@ -24,9 +24,9 @@ struct DnsEntry {
int64 TTL = 0;
};
constexpr auto kSendNextTimeout = TimeMs(1000);
constexpr auto kMinTimeToLive = 10 * TimeMs(1000);
constexpr auto kMaxTimeToLive = 300 * TimeMs(1000);
constexpr auto kSendNextTimeout = crl::time(1000);
constexpr auto kMinTimeToLive = 10 * crl::time(1000);
constexpr auto kMaxTimeToLive = 300 * crl::time(1000);
constexpr auto kPublicKey = str_const("\
-----BEGIN RSA PUBLIC KEY-----\n\
@@ -428,7 +428,7 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
DomainResolver::DomainResolver(Fn<void(
const QString &host,
const QStringList &ips,
TimeMs expireAt)> callback)
crl::time expireAt)> callback)
: _callback(std::move(callback)) {
_manager.setProxy(QNetworkProxy::NoProxy);
}
@@ -445,7 +445,7 @@ void DomainResolver::resolve(const AttemptKey &key) {
return;
}
const auto i = _cache.find(key);
_lastTimestamp = getms(true);
_lastTimestamp = crl::now();
if (i != end(_cache) && i->second.expireAt > _lastTimestamp) {
checkExpireAndPushResult(key.domain);
return;
@@ -530,10 +530,10 @@ void DomainResolver::requestFinished(
for (const auto &item : response) {
entry.ips.push_back(item.data);
accumulate_min(ttl, std::max(
item.TTL * TimeMs(1000),
item.TTL * crl::time(1000),
kMinTimeToLive));
}
_lastTimestamp = getms(true);
_lastTimestamp = crl::now();
entry.expireAt = _lastTimestamp + ttl;
_cache[key] = std::move(entry);