Never set 0 session_id.

GitOrigin-RevId: 58a7074812fa330930b033d2ffcfcc1ae0e803ec
This commit is contained in:
levlam 2019-02-04 19:39:09 +03:00
parent f89dbc8148
commit 72ac6667ce

View File

@ -132,7 +132,9 @@ Session::Session(unique_ptr<Callback> callback, std::shared_ptr<AuthDataShared>
auth_data_.set_future_salts(std::move(server_salts), Time::now());
}
uint64 session_id = 0;
Random::secure_bytes(reinterpret_cast<uint8 *>(&session_id), sizeof(session_id));
do {
Random::secure_bytes(reinterpret_cast<uint8 *>(&session_id), sizeof(session_id));
} while (session_id == 0);
auth_data_.set_session_id(session_id);
LOG(WARNING) << "Generate new session_id " << session_id << " for " << (use_pfs ? "temp " : "")
<< (is_cdn ? "CDN " : "") << "auth key " << auth_data_.get_auth_key().id() << " for DC" << dc_id;