diff options
| author | levlam <levlam@telegram.org> | 2023-05-04 16:00:14 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2023-05-04 16:00:14 +0300 |
| commit | fc136f46df5321022bd38bf5cc33ab346b82ea84 (patch) | |
| tree | c662256efa20c5308521b809f310e0b0fb9db34e | |
| parent | d3ade3d64dfcd20c7bcd4faeeb6837d62af3c351 (diff) | |
Randomize temporary auth key validity time.
| -rw-r--r-- | td/telegram/net/Session.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 8392c100f..a4b6dd859 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -1451,7 +1451,8 @@ void Session::create_gen_auth_key_actor(HandshakeId handshake_id) { info.flag_ = true; bool is_main = handshake_id == MainAuthKeyHandshake; if (!info.handshake_) { - info.handshake_ = make_unique<mtproto::AuthKeyHandshake>(dc_id_, is_main && !is_cdn_ ? 0 : 24 * 60 * 60); + auto key_validity_time = is_main && !is_cdn_ ? 0 : Random::fast(23 * 60 * 60, 24 * 60 * 60); + info.handshake_ = make_unique<mtproto::AuthKeyHandshake>(dc_id_, key_validity_time); } class AuthKeyHandshakeContext final : public mtproto::AuthKeyHandshakeContext { public: |
