diff options
| author | levlam <levlam@telegram.org> | 2020-11-21 16:34:39 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2020-11-21 16:34:39 +0300 |
| commit | 5cbf90e4a081567593247bd96adc4eec2e9156d8 (patch) | |
| tree | ef8a0da140691effbebde929925044d129b56c16 /tdnet/td/net/GetHostByNameActor.cpp | |
| parent | e8cd3d9af2bfce453ac804228d406c80f7517f3c (diff) | |
Safer work with negative monotonic time.
Diffstat (limited to 'tdnet/td/net/GetHostByNameActor.cpp')
| -rw-r--r-- | tdnet/td/net/GetHostByNameActor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tdnet/td/net/GetHostByNameActor.cpp b/tdnet/td/net/GetHostByNameActor.cpp index 7ac5bac4a..884da3ddf 100644 --- a/tdnet/td/net/GetHostByNameActor.cpp +++ b/tdnet/td/net/GetHostByNameActor.cpp @@ -130,8 +130,8 @@ void GetHostByNameActor::run(string host, int port, bool prefer_ipv6, Promise<IP } auto ascii_host = r_ascii_host.move_as_ok(); - auto &value = cache_[prefer_ipv6].emplace(ascii_host, Value{{}, 0}).first->second; auto begin_time = Time::now(); + auto &value = cache_[prefer_ipv6].emplace(ascii_host, Value{{}, begin_time - 1.0}).first->second; if (value.expires_at > begin_time) { return promise.set_result(value.get_ip_port(port)); } |
