Delete unused fields. Add test.

GitOrigin-RevId: 6ce7ff71d926142a7c178d56a2f489f1634322b9
This commit is contained in:
levlam 2018-05-18 19:44:46 +03:00
parent 2691c7fabf
commit b3ca84fffb
3 changed files with 5 additions and 5 deletions

View File

@ -243,7 +243,6 @@ ActorOwn<> get_full_config(DcId dc_id, IPAddress ip_address, Promise<FullConfig>
} }
double get_server_time_difference() override { double get_server_time_difference() override {
return G()->get_server_time_difference(); return G()->get_server_time_difference();
//return server_time_difference_;
} }
void add_auth_key_listener(unique_ptr<Listener> listener) override { void add_auth_key_listener(unique_ptr<Listener> listener) override {
if (listener->notify()) { if (listener->notify()) {
@ -267,8 +266,6 @@ ActorOwn<> get_full_config(DcId dc_id, IPAddress ip_address, Promise<FullConfig>
private: private:
DcId dc_id_; DcId dc_id_;
std::shared_ptr<PublicRsaKeyShared> public_rsa_key_ = std::make_shared<PublicRsaKeyShared>(DcId::empty()); std::shared_ptr<PublicRsaKeyShared> public_rsa_key_ = std::make_shared<PublicRsaKeyShared>(DcId::empty());
bool has_server_time_difference_ = false;
double server_time_difference_ = 0;
std::vector<std::unique_ptr<Listener>> auth_key_listeners_; std::vector<std::unique_ptr<Listener>> auth_key_listeners_;
void notify() { void notify() {
@ -277,10 +274,10 @@ ActorOwn<> get_full_config(DcId dc_id, IPAddress ip_address, Promise<FullConfig>
auth_key_listeners_.erase(it, auth_key_listeners_.end()); auth_key_listeners_.erase(it, auth_key_listeners_.end());
} }
string auth_key_key() { string auth_key_key() const {
return PSTRING() << "config_recovery_auth" << dc_id().get_raw_id(); return PSTRING() << "config_recovery_auth" << dc_id().get_raw_id();
} }
string future_salts_key() { string future_salts_key() const {
return PSTRING() << "config_recovery_salt" << dc_id().get_raw_id(); return PSTRING() << "config_recovery_salt" << dc_id().get_raw_id();
} }
}; };

View File

@ -10,6 +10,7 @@
#include "td/utils/Time.h" #include "td/utils/Time.h"
namespace td { namespace td {
GetHostByNameActor::GetHostByNameActor(int32 ok_timeout, int32 error_timeout) GetHostByNameActor::GetHostByNameActor(int32 ok_timeout, int32 error_timeout)
: ok_timeout_(ok_timeout), error_timeout_(error_timeout) { : ok_timeout_(ok_timeout), error_timeout_(error_timeout) {
} }
@ -45,4 +46,5 @@ Result<td::IPAddress> GetHostByNameActor::load_ip(string host, int port) {
return std::move(status); return std::move(status);
} }
} }
} // namespace td } // namespace td

View File

@ -298,6 +298,7 @@ TEST(Misc, idn_to_ascii) {
test_idn_to_ascii_one("win-2k12r2-addc.阿伯测阿伯测ad.hai.com", "win-2k12r2-addc.xn--ad-tl3ca3569aba8944eca.hai.com"); test_idn_to_ascii_one("win-2k12r2-addc.阿伯测阿伯测ad.hai.com", "win-2k12r2-addc.xn--ad-tl3ca3569aba8944eca.hai.com");
test_idn_to_ascii_one("✌️.ws", "xn--7bi.ws"); test_idn_to_ascii_one("✌️.ws", "xn--7bi.ws");
test_idn_to_ascii_one("", "xn--59h"); test_idn_to_ascii_one("", "xn--59h");
test_idn_to_ascii_one("--рф.рф", "xn-----mmcq.xn--p1ai");
ASSERT_TRUE(idn_to_ascii("\xc0").is_error()); ASSERT_TRUE(idn_to_ascii("\xc0").is_error());
} }