Use "receive"/"have"/"loaded" instead of "got" and other log message improvements.

This commit is contained in:
levlam 2023-02-26 14:22:31 +03:00
parent ffcc1719ef
commit 22fdc0258b
31 changed files with 101 additions and 103 deletions

View File

@ -859,8 +859,8 @@ static void test_queue() {
for (size_t i = 0; i < THREAD_COUNT; i++) { for (size_t i = 0; i < THREAD_COUNT; i++) {
threads.emplace_back([&q = queues[i]] { threads.emplace_back([&q = queues[i]] {
while (true) { while (true) {
auto got = q.reader_wait_nonblock(); auto ready_count = q.reader_wait_nonblock();
while (got-- > 0) { while (ready_count-- > 0) {
q.reader_get_unsafe(); q.reader_get_unsafe();
} }
q.reader_get_event_fd().wait(1000); q.reader_get_event_fd().wait(1000);

View File

@ -222,8 +222,8 @@ class TdExample {
if (update_new_message.message_->content_->get_id() == td_api::messageText::ID) { if (update_new_message.message_->content_->get_id() == td_api::messageText::ID) {
text = static_cast<td_api::messageText &>(*update_new_message.message_->content_).text_->text_; text = static_cast<td_api::messageText &>(*update_new_message.message_->content_).text_->text_;
} }
std::cout << "Got message: [chat_id:" << chat_id << "] [from:" << sender_name << "] [" << text std::cout << "Receive message: [chat_id:" << chat_id << "] [from:" << sender_name << "] ["
<< "]" << std::endl; << text << "]" << std::endl;
}, },
[](auto &update) {})); [](auto &update) {}));
} }
@ -242,7 +242,7 @@ class TdExample {
overloaded( overloaded(
[this](td_api::authorizationStateReady &) { [this](td_api::authorizationStateReady &) {
are_authorized_ = true; are_authorized_ = true;
std::cout << "Got authorization" << std::endl; std::cout << "Authorization is completed" << std::endl;
}, },
[this](td_api::authorizationStateLoggingOut &) { [this](td_api::authorizationStateLoggingOut &) {
are_authorized_ = false; are_authorized_ = false;

View File

@ -253,7 +253,7 @@ class TdClient {
log.info('ignore self broadcast message: ', message); log.info('ignore self broadcast message: ', message);
return; return;
} }
log.info('got broadcast message: ', message); log.info('receive broadcast message: ', message);
if (message.isBackground && !this.isBackground) { if (message.isBackground && !this.isBackground) {
// continue // continue
} else if ( } else if (
@ -506,7 +506,7 @@ class FileManager {
} }
if (info.arr) { if (info.arr) {
log.warn('Got file.arr at least twice for the same file'); log.warn('Receive file.arr at least twice for the same file');
this.totalSize -= info.arr.length; this.totalSize -= info.arr.length;
} }
info.arr = file.arr; info.arr = file.arr;
@ -543,7 +543,7 @@ class FileManager {
const blob = event.target.result; const blob = event.target.result;
if (blob) { if (blob) {
if (blob.size === 0) { if (blob.size === 0) {
log.error('Got empty blob from db ', query.key); log.error('Receive empty blob from db ', query.key);
} }
query.resolve({ data: blob, transaction_id: transaction_id }); query.resolve({ data: blob, transaction_id: transaction_id });
} else { } else {

View File

@ -65,7 +65,7 @@ async function loadTdlibWasm(onFS, wasmUrl) {
console.log('loadTdlibWasm'); console.log('loadTdlibWasm');
const td_module = await import('./prebuilt/release/td_wasm.js'); const td_module = await import('./prebuilt/release/td_wasm.js');
const createTdwebModule = td_module.default; const createTdwebModule = td_module.default;
log.info('got td_wasm.js', td_module, createTdwebModule); log.info('receive td_wasm.js', td_module, createTdwebModule);
let td_wasm = td_wasm_release; let td_wasm = td_wasm_release;
if (wasmUrl) { if (wasmUrl) {
td_wasm = wasmUrl; td_wasm = wasmUrl;
@ -88,7 +88,7 @@ async function loadTdlibWasm(onFS, wasmUrl) {
}); });
log.info('Wait module'); log.info('Wait module');
module = await module; module = await module;
log.info('Got module', module); log.info('Loaded module', module);
//onFS(module.FS); //onFS(module.FS);
return module; return module;
} }
@ -97,7 +97,7 @@ async function loadTdlibAsmjs(onFS) {
console.log('loadTdlibAsmjs'); console.log('loadTdlibAsmjs');
const createTdwebModule = (await import('./prebuilt/release/td_asmjs.js')) const createTdwebModule = (await import('./prebuilt/release/td_asmjs.js'))
.default; .default;
console.log('got td_asm.js', createTdwebModule); console.log('Loaded td_asm.js', createTdwebModule);
const fromFile = 'td_asmjs.js.mem'; const fromFile = 'td_asmjs.js.mem';
const toFile = td_asmjs_mem_release; const toFile = td_asmjs_mem_release;
let module = createTdwebModule({ let module = createTdwebModule({
@ -115,7 +115,7 @@ async function loadTdlibAsmjs(onFS) {
}); });
log.info('Wait module'); log.info('Wait module');
module = await module; module = await module;
log.info('Got module', module); log.info('Loaded module', module);
//onFS(module.FS); //onFS(module.FS);
return module; return module;
} }
@ -575,7 +575,7 @@ class TdClient {
await localforage.setItem('hello', 'world'); await localforage.setItem('hello', 'world');
console.log('B'); console.log('B');
const x = await localforage.getItem('hello'); const x = await localforage.getItem('hello');
console.log('got ', x); console.log('receive ', x);
await localforage.clear(); await localforage.clear();
console.log('C'); console.log('C');
} catch (error) { } catch (error) {
@ -612,7 +612,7 @@ class TdClient {
log.info('load TdModule'); log.info('load TdModule');
this.TdModule = await loadTdlib(mode, this.onFS, options.wasmUrl); this.TdModule = await loadTdlib(mode, this.onFS, options.wasmUrl);
log.info('got TdModule'); log.info('loaded TdModule');
this.td_functions = { this.td_functions = {
td_create: this.TdModule.cwrap( td_create: this.TdModule.cwrap(
'td_emscripten_create_client_id', 'td_emscripten_create_client_id',

View File

@ -539,7 +539,7 @@ Status SessionConnection::on_main_packet(const PacketInfo &info, Slice packet) {
callback_->on_connected(); callback_->on_connected();
} }
VLOG(raw_mtproto) << "Got packet of size " << packet.size() << " from session " << format::as_hex(info.session_id) VLOG(raw_mtproto) << "Receive packet of size " << packet.size() << " from session " << format::as_hex(info.session_id)
<< ":" << format::as_hex_dump<4>(packet); << ":" << format::as_hex_dump<4>(packet);
if (info.no_crypto_flag) { if (info.no_crypto_flag) {
return Status::Error("Unencrypted packet"); return Status::Error("Unencrypted packet");

View File

@ -674,7 +674,7 @@ class ConfigRecoverer final : public Actor {
} }
} }
} }
VLOG(config_recoverer) << "Got SimpleConfig " << simple_config_; VLOG(config_recoverer) << "Receive SimpleConfig " << simple_config_;
} else { } else {
VLOG(config_recoverer) << "Config has expired at " << config->expires_; VLOG(config_recoverer) << "Config has expired at " << config->expires_;
} }
@ -927,7 +927,8 @@ ActorShared<> ConfigManager::create_reference() {
} }
void ConfigManager::hangup_shared() { void ConfigManager::hangup_shared() {
LOG_CHECK(get_link_token() == REFCNT_TOKEN) << "Expected REFCNT_TOKEN, got " << get_link_token(); LOG_CHECK(get_link_token() == REFCNT_TOKEN)
<< "Expected link token " << REFCNT_TOKEN << ", but receive " << get_link_token();
ref_cnt_--; ref_cnt_--;
try_stop(); try_stop();
} }

View File

@ -451,7 +451,7 @@ void DeviceTokenManager::on_result(NetQueryPtr net_query) {
} }
info.promise.set_error(r_flag.move_as_error()); info.promise.set_error(r_flag.move_as_error());
} else { } else {
info.promise.set_error(Status::Error(400, "Got false as result of registerDevice server request")); info.promise.set_error(Status::Error(400, "Receive false as result of registerDevice server request"));
} }
if (info.state == TokenInfo::State::Reregister) { if (info.state == TokenInfo::State::Reregister) {
// keep trying to reregister the token // keep trying to reregister the token

View File

@ -337,7 +337,7 @@ string InlineQueriesManager::get_inline_message_id(
if (input_bot_inline_message_id == nullptr) { if (input_bot_inline_message_id == nullptr) {
return string(); return string();
} }
LOG(INFO) << "Got inline message identifier: " << to_string(input_bot_inline_message_id); LOG(INFO) << "Receive inline message identifier: " << to_string(input_bot_inline_message_id);
return base64url_encode(serialize(*input_bot_inline_message_id)); return base64url_encode(serialize(*input_bot_inline_message_id));
} }

View File

@ -14183,8 +14183,8 @@ void MessagesManager::ttl_db_on_result(Result<std::pair<std::vector<MessageDbMes
ttl_db_expires_from_ = ttl_db_expires_till_; ttl_db_expires_from_ = ttl_db_expires_till_;
ttl_db_expires_till_ = result.second; ttl_db_expires_till_ = result.second;
LOG(INFO) << "Receive ttl_db query result " << tag("new expires_till", ttl_db_expires_till_) LOG(INFO) << "Receive " << result.first.size()
<< tag("got messages", result.first.size()); << " expired messages from database with new expires_till = " << ttl_db_expires_till_;
for (auto &dialog_message : result.first) { for (auto &dialog_message : result.first) {
on_get_message_from_database(dialog_message, false, "ttl_db_on_result"); on_get_message_from_database(dialog_message, false, "ttl_db_on_result");
} }
@ -35342,7 +35342,7 @@ MessagesManager::Message *MessagesManager::on_get_message_from_database(const Me
if (d == nullptr) { if (d == nullptr) {
LOG(ERROR) << "Can't find " << dialog_id << ", but have a message from it from " << source; LOG(ERROR) << "Can't find " << dialog_id << ", but have a message from it from " << source;
if (!dialog_id.is_valid()) { if (!dialog_id.is_valid()) {
LOG(ERROR) << "Got message in invalid " << dialog_id << " from " << source; LOG(ERROR) << "Receive message in invalid " << dialog_id << " from " << source;
return nullptr; return nullptr;
} }

View File

@ -307,7 +307,7 @@ Result<PrivacyManager::UserPrivacySettingRule> PrivacyManager::UserPrivacySettin
auto td = G()->td().get_actor_unsafe(); auto td = G()->td().get_actor_unsafe();
for (auto user_id : result.user_ids_) { for (auto user_id : result.user_ids_) {
if (!td->contacts_manager_->have_user(user_id)) { if (!td->contacts_manager_->have_user(user_id)) {
return Status::Error(500, "Got inaccessible user from the server"); return Status::Error(500, "Receive inaccessible user from the server");
} }
} }
for (auto chat_id_int : result.chat_ids_) { for (auto chat_id_int : result.chat_ids_) {
@ -317,7 +317,7 @@ Result<PrivacyManager::UserPrivacySettingRule> PrivacyManager::UserPrivacySettin
ChannelId channel_id(chat_id_int); ChannelId channel_id(chat_id_int);
dialog_id = DialogId(channel_id); dialog_id = DialogId(channel_id);
if (!td->contacts_manager_->have_channel(channel_id)) { if (!td->contacts_manager_->have_channel(channel_id)) {
return Status::Error(500, "Got inaccessible chat from the server"); return Status::Error(500, "Receive inaccessible chat from the server");
} }
} }
td->messages_manager_->force_create_dialog(dialog_id, "UserPrivacySettingRule"); td->messages_manager_->force_create_dialog(dialog_id, "UserPrivacySettingRule");

View File

@ -809,11 +809,11 @@ Result<std::tuple<uint64, BufferSlice, int32>> SecretChatActor::decrypt(BufferSl
TRY_RESULT(read_result, std::move(r_read_result)); TRY_RESULT(read_result, std::move(r_read_result));
switch (read_result.type()) { switch (read_result.type()) {
case mtproto::Transport::ReadResult::Quickack: case mtproto::Transport::ReadResult::Quickack:
return Status::Error("Got quickack instead of a message"); return Status::Error("Receive quickack instead of a message");
case mtproto::Transport::ReadResult::Error: case mtproto::Transport::ReadResult::Error:
return Status::Error(PSLICE() << "Got MTProto error code instead of a message: " << read_result.error()); return Status::Error(PSLICE() << "Receive MTProto error code instead of a message: " << read_result.error());
case mtproto::Transport::ReadResult::Nop: case mtproto::Transport::ReadResult::Nop:
return Status::Error("Got nop instead of a message"); return Status::Error("Receive nop instead of a message");
case mtproto::Transport::ReadResult::Packet: case mtproto::Transport::ReadResult::Packet:
data = read_result.packet(); data = read_result.packet();
break; break;
@ -1582,7 +1582,7 @@ void SecretChatActor::on_outbound_send_message_result(NetQueryPtr query, Promise
} }
auto result = r_result.move_as_ok(); auto result = r_result.move_as_ok();
LOG(INFO) << "Got messages_sendEncrypted result: " << tag("message_id", state->message->message_id) LOG(INFO) << "Receive messages_sendEncrypted result: " << tag("message_id", state->message->message_id)
<< tag("random_id", state->message->random_id) << to_string(*result); << tag("random_id", state->message->random_id) << to_string(*result);
auto send_message_finish_promise = PromiseCreator::lambda([actor_id = actor_id(this), state_id](Result<> result) { auto send_message_finish_promise = PromiseCreator::lambda([actor_id = actor_id(this), state_id](Result<> result) {
@ -1913,7 +1913,7 @@ void SecretChatActor::get_dh_config() {
} }
Status SecretChatActor::on_dh_config(NetQueryPtr query) { Status SecretChatActor::on_dh_config(NetQueryPtr query) {
LOG(INFO) << "Got DH config"; LOG(INFO) << "Receive DH config";
TRY_RESULT(config, fetch_result<telegram_api::messages_getDhConfig>(std::move(query))); TRY_RESULT(config, fetch_result<telegram_api::messages_getDhConfig>(std::move(query)));
downcast_call(*config, [&](auto &obj) { this->on_dh_config(obj); }); downcast_call(*config, [&](auto &obj) { this->on_dh_config(obj); });
TRY_STATUS(mtproto::DhHandshake::check_config(auth_state_.dh_config.g, auth_state_.dh_config.prime, TRY_STATUS(mtproto::DhHandshake::check_config(auth_state_.dh_config.g, auth_state_.dh_config.prime,
@ -2104,7 +2104,7 @@ Status SecretChatActor::on_inbound_action(secret_api::decryptedMessageActionRequ
return Status::Error("Unexpected RequestKey"); return Status::Error("Unexpected RequestKey");
} }
if (!pfs_state_.other_auth_key.empty()) { if (!pfs_state_.other_auth_key.empty()) {
LOG_CHECK(pfs_state_.can_forget_other_key) << "TODO: got requestKey, before old key is dropped"; LOG_CHECK(pfs_state_.can_forget_other_key) << "TODO: receive requestKey, before old key is dropped";
return Status::Error("Unexpected RequestKey (old key is used)"); return Status::Error("Unexpected RequestKey (old key is used)");
} }
pfs_state_.state = PfsState::SendAccept; pfs_state_.state = PfsState::SendAccept;

View File

@ -231,7 +231,7 @@ void GetSecureValue::on_result(NetQueryPtr query) {
return on_error(Status::Error(404, "Not Found")); return on_error(Status::Error(404, "Not Found"));
} }
if (result.size() != 1) { if (result.size() != 1) {
return on_error(Status::Error(PSLICE() << "Expected vector of size 1 got " << result.size())); return on_error(Status::Error(PSLICE() << "Expected result of size 1, but receive of size " << result.size()));
} }
encrypted_secure_value_ = encrypted_secure_value_ =
get_encrypted_secure_value(G()->td().get_actor_unsafe()->file_manager_.get(), std::move(result[0])); get_encrypted_secure_value(G()->td().get_actor_unsafe()->file_manager_.get(), std::move(result[0]));

View File

@ -352,7 +352,7 @@ Status TdDb::init_sqlite(const TdParameters &parameters, const DbKey &key, const
// Get 'PRAGMA user_version' // Get 'PRAGMA user_version'
TRY_RESULT(user_version, db.user_version()); TRY_RESULT(user_version, db.user_version());
LOG(INFO) << "Got PRAGMA user_version = " << user_version; LOG(INFO) << "Have PRAGMA user_version = " << user_version;
// init DialogDb // init DialogDb
bool dialog_db_was_created = false; bool dialog_db_was_created = false;

View File

@ -2505,7 +2505,7 @@ void UpdatesManager::add_pending_pts_update(tl_object_ptr<telegram_api::Update>
} }
if (running_get_difference_ || !postponed_pts_updates_.empty()) { if (running_get_difference_ || !postponed_pts_updates_.empty()) {
LOG(INFO) << "Save pending update got while running getDifference from " << source; LOG(INFO) << "Save pending update received while running getDifference from " << source;
postpone_pts_update(std::move(update), new_pts, pts_count, receive_time, std::move(promise)); postpone_pts_update(std::move(update), new_pts, pts_count, receive_time, std::move(promise));
return; return;
} }

View File

@ -424,7 +424,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
if (td_->auth_manager_->is_bot()) { if (td_->auth_manager_->is_bot()) {
return WebPageId(); return WebPageId();
} }
LOG(DEBUG) << "Got " << to_string(web_page_ptr); LOG(DEBUG) << "Receive " << to_string(web_page_ptr);
switch (web_page_ptr->get_id()) { switch (web_page_ptr->get_id()) {
case telegram_api::webPageEmpty::ID: { case telegram_api::webPageEmpty::ID: {
auto web_page = move_tl_object_as<telegram_api::webPageEmpty>(web_page_ptr); auto web_page = move_tl_object_as<telegram_api::webPageEmpty>(web_page_ptr);
@ -434,7 +434,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
return WebPageId(); return WebPageId();
} }
LOG(INFO) << "Got empty " << web_page_id; LOG(INFO) << "Receive empty " << web_page_id;
const WebPage *web_page_to_delete = get_web_page(web_page_id); const WebPage *web_page_to_delete = get_web_page(web_page_id);
if (web_page_to_delete != nullptr) { if (web_page_to_delete != nullptr) {
if (web_page_to_delete->log_event_id != 0) { if (web_page_to_delete->log_event_id != 0) {
@ -467,7 +467,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
} }
auto web_page_date = web_page->date_; auto web_page_date = web_page->date_;
LOG(INFO) << "Got pending " << web_page_id << ", force_get_date = " << web_page_date LOG(INFO) << "Receive pending " << web_page_id << ", force_get_date = " << web_page_date
<< ", now = " << G()->server_time(); << ", now = " << G()->server_time();
pending_web_pages_timeout_.add_timeout_in(web_page_id.get(), max(web_page_date - G()->server_time(), 1.0)); pending_web_pages_timeout_.add_timeout_in(web_page_id.get(), max(web_page_date - G()->server_time(), 1.0));
@ -481,7 +481,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
return WebPageId(); return WebPageId();
} }
LOG(INFO) << "Got " << web_page_id; LOG(INFO) << "Receive " << web_page_id;
auto page = make_unique<WebPage>(); auto page = make_unique<WebPage>();
page->url = std::move(web_page->url_); page->url = std::move(web_page->url_);

View File

@ -166,7 +166,7 @@ Result<bool> FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que
TRY_RESULT(file_base, fetch_result<telegram_api::upload_getFile>(net_query->ok())); TRY_RESULT(file_base, fetch_result<telegram_api::upload_getFile>(net_query->ok()));
CHECK(file_base->get_id() == telegram_api::upload_fileCdnRedirect::ID); CHECK(file_base->get_id() == telegram_api::upload_fileCdnRedirect::ID);
auto file = move_tl_object_as<telegram_api::upload_fileCdnRedirect>(file_base); auto file = move_tl_object_as<telegram_api::upload_fileCdnRedirect>(file_base);
LOG(DEBUG) << part.id << " got REDIRECT " << to_string(file); LOG(DEBUG) << "Downloading of part " << part.id << " was redirected to " << oneline(to_string(file));
auto new_cdn_file_token = file->file_token_.as_slice(); auto new_cdn_file_token = file->file_token_.as_slice();
if (cdn_file_token_ == new_cdn_file_token) { if (cdn_file_token_ == new_cdn_file_token) {
@ -192,7 +192,7 @@ Result<bool> FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que
case QueryType::ReuploadCDN: { case QueryType::ReuploadCDN: {
TRY_RESULT(file_hashes, fetch_result<telegram_api::upload_reuploadCdnFile>(net_query->ok())); TRY_RESULT(file_hashes, fetch_result<telegram_api::upload_reuploadCdnFile>(net_query->ok()));
add_hash_info(file_hashes); add_hash_info(file_hashes);
LOG(DEBUG) << part.id << " got REUPLOAD_OK"; LOG(DEBUG) << "Part " << part.id << " was reuplaoded to CDN";
return true; return true;
} }
case QueryType::CDN: { case QueryType::CDN: {
@ -200,14 +200,14 @@ Result<bool> FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que
TRY_RESULT(file_base, fetch_result<telegram_api::upload_getCdnFile>(net_query->ok())); TRY_RESULT(file_base, fetch_result<telegram_api::upload_getCdnFile>(net_query->ok()));
CHECK(file_base->get_id() == telegram_api::upload_cdnFileReuploadNeeded::ID); CHECK(file_base->get_id() == telegram_api::upload_cdnFileReuploadNeeded::ID);
auto file = move_tl_object_as<telegram_api::upload_cdnFileReuploadNeeded>(file_base); auto file = move_tl_object_as<telegram_api::upload_cdnFileReuploadNeeded>(file_base);
LOG(DEBUG) << part.id << " got REUPLOAD " << to_string(file); LOG(DEBUG) << "Part " << part.id << " must be reuplaoded to " << oneline(to_string(file));
cdn_part_reupload_token_[part.id] = file->request_token_.as_slice().str(); cdn_part_reupload_token_[part.id] = file->request_token_.as_slice().str();
return true; return true;
} }
auto it = cdn_part_file_token_generation_.find(part.id); auto it = cdn_part_file_token_generation_.find(part.id);
CHECK(it != cdn_part_file_token_generation_.end()); CHECK(it != cdn_part_file_token_generation_.end());
if (it->second != cdn_file_token_generation_) { if (it->second != cdn_file_token_generation_) {
LOG(DEBUG) << part.id << " got part with old file_token"; LOG(DEBUG) << "Receive part " << part.id << " with an old file_token";
return true; return true;
} }
return false; return false;
@ -266,13 +266,11 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
if (it == cdn_part_reupload_token_.end()) { if (it == cdn_part_reupload_token_.end()) {
auto query = telegram_api::upload_getCdnFile(BufferSlice(cdn_file_token_), part.offset, narrow_cast<int32>(size)); auto query = telegram_api::upload_getCdnFile(BufferSlice(cdn_file_token_), part.offset, narrow_cast<int32>(size));
cdn_part_file_token_generation_[part.id] = cdn_file_token_generation_; cdn_part_file_token_generation_[part.id] = cdn_file_token_generation_;
LOG(DEBUG) << part.id << " " << to_string(query);
net_query = net_query =
G()->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::CDN)), G()->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::CDN)),
query, {}, cdn_dc_id_, net_query_type, NetQuery::AuthFlag::Off); query, {}, cdn_dc_id_, net_query_type, NetQuery::AuthFlag::Off);
} else { } else {
auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second)); auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second));
LOG(DEBUG) << part.id << " " << to_string(query);
net_query = G()->net_query_creator().create( net_query = G()->net_query_creator().create(
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), query, {}, UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), query, {},
remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On); remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On);
@ -311,7 +309,7 @@ Result<size_t> FileDownloader::process_part(Part part, NetQueryPtr net_query) {
TRY_RESULT(file_base, fetch_result<telegram_api::upload_getFile>(net_query->ok())); TRY_RESULT(file_base, fetch_result<telegram_api::upload_getFile>(net_query->ok()));
CHECK(file_base->get_id() == telegram_api::upload_file::ID); CHECK(file_base->get_id() == telegram_api::upload_file::ID);
auto file = move_tl_object_as<telegram_api::upload_file>(file_base); auto file = move_tl_object_as<telegram_api::upload_file>(file_base);
LOG(DEBUG) << part.id << " upload.getFile result " << to_string(file); LOG(DEBUG) << "Receive part " << part.id << ": " << to_string(file);
bytes = std::move(file->bytes_); bytes = std::move(file->bytes_);
} }
break; break;
@ -320,7 +318,7 @@ Result<size_t> FileDownloader::process_part(Part part, NetQueryPtr net_query) {
TRY_RESULT(file_base, fetch_result<telegram_api::upload_getCdnFile>(net_query->ok())); TRY_RESULT(file_base, fetch_result<telegram_api::upload_getCdnFile>(net_query->ok()));
CHECK(file_base->get_id() == telegram_api::upload_cdnFile::ID); CHECK(file_base->get_id() == telegram_api::upload_cdnFile::ID);
auto file = move_tl_object_as<telegram_api::upload_cdnFile>(file_base); auto file = move_tl_object_as<telegram_api::upload_cdnFile>(file_base);
LOG(DEBUG) << part.id << " upload.getCdnFile result " << to_string(file); LOG(DEBUG) << "Receive part " << part.id << " from CDN: " << to_string(file);
bytes = std::move(file->bytes_); bytes = std::move(file->bytes_);
need_cdn_decrypt = true; need_cdn_decrypt = true;
break; break;
@ -366,7 +364,7 @@ Result<size_t> FileDownloader::process_part(Part part, NetQueryPtr net_query) {
auto slice = bytes.as_slice().substr(0, part.size); auto slice = bytes.as_slice().substr(0, part.size);
TRY_STATUS(acquire_fd()); TRY_STATUS(acquire_fd());
LOG(INFO) << "Got " << slice.size() << " bytes at offset " << part.offset << " for \"" << path_ << '"'; LOG(INFO) << "Receive " << slice.size() << " bytes at offset " << part.offset << " for \"" << path_ << '"';
TRY_RESULT(written, fd_.pwrite(slice, part.offset)); TRY_RESULT(written, fd_.pwrite(slice, part.offset));
LOG(INFO) << "Written " << written << " bytes"; LOG(INFO) << "Written " << written << " bytes";
// may write less than part.size, when size of downloadable file is unknown // may write less than part.size, when size of downloadable file is unknown

View File

@ -196,7 +196,7 @@ Status FileLoader::do_loop() {
break; break;
} }
if (resource_state_.unused() < narrow_cast<int64>(parts_manager_.get_part_size())) { if (resource_state_.unused() < narrow_cast<int64>(parts_manager_.get_part_size())) {
VLOG(file_loader) << "Got only " << resource_state_.unused() << " resource"; VLOG(file_loader) << "Receive only " << resource_state_.unused() << " resource";
break; break;
} }
TRY_RESULT(part, parts_manager_.start_part()); TRY_RESULT(part, parts_manager_.start_part());
@ -268,7 +268,7 @@ void FileLoader::on_result(NetQueryPtr query) {
} }
auto it = part_map_.find(unique_id); auto it = part_map_.find(unique_id);
if (it == part_map_.end()) { if (it == part_map_.end()) {
LOG(WARNING) << "Got result for unknown part"; LOG(WARNING) << "Receive result for unknown part";
return; return;
} }

View File

@ -130,7 +130,7 @@ class NetQuery final : public TsListNode<NetQueryDebug> {
} }
void set_ok(BufferSlice slice) { void set_ok(BufferSlice slice) {
VLOG(net_query) << "Got answer " << *this; VLOG(net_query) << "Receive answer " << *this;
CHECK(state_ == State::Query); CHECK(state_ == State::Query);
answer_ = std::move(slice); answer_ = std::move(slice);
state_ = State::OK; state_ = State::OK;
@ -323,7 +323,7 @@ class NetQuery final : public TsListNode<NetQueryDebug> {
ActorShared<NetQueryCallback> callback_; ActorShared<NetQueryCallback> callback_;
void set_error_impl(Status status, string source = string()) { void set_error_impl(Status status, string source = string()) {
VLOG(net_query) << "Got error " << *this << " " << status; VLOG(net_query) << "Receive error " << *this << " " << status;
status_ = std::move(status); status_ = std::move(status);
state_ = State::Error; state_ = State::Error;
source_ = std::move(source); source_ = std::move(source);

View File

@ -373,7 +373,7 @@ void Session::send(NetQueryPtr &&query) {
// query->debug(PSTRING() << get_name() << ": received from SessionProxy"); // query->debug(PSTRING() << get_name() << ": received from SessionProxy");
query->set_session_id(auth_data_.get_session_id()); query->set_session_id(auth_data_.get_session_id());
VLOG(net_query) << "Got query " << query; VLOG(net_query) << "Receive query " << query;
if (query->update_is_ready()) { if (query->update_is_ready()) {
return_query(std::move(query)); return_query(std::move(query));
return; return;
@ -417,7 +417,7 @@ void Session::on_bind_result(NetQueryPtr query) {
} else { } else {
need_check_main_key_ = true; need_check_main_key_ = true;
auth_data_.set_use_pfs(false); auth_data_.set_use_pfs(false);
LOG(WARNING) << "Got ENCRYPTED_MESSAGE_INVALID error, validate main key" << debug; LOG(WARNING) << "Receive ENCRYPTED_MESSAGE_INVALID error, validate main key" << debug;
} }
} }
} }
@ -1254,7 +1254,7 @@ void Session::connection_open_finish(ConnectionInfo *info,
auto raw_connection = r_raw_connection.move_as_ok(); auto raw_connection = r_raw_connection.move_as_ok();
VLOG(dc) << "Receive raw connection " << raw_connection.get(); VLOG(dc) << "Receive raw connection " << raw_connection.get();
if (raw_connection->extra().extra != network_generation_) { if (raw_connection->extra().extra != network_generation_) {
LOG(WARNING) << "Got RawConnection with old network_generation"; LOG(WARNING) << "Receive RawConnection with old network_generation";
info->state_ = ConnectionInfo::State::Empty; info->state_ = ConnectionInfo::State::Empty;
yield(); yield();
return; return;
@ -1434,7 +1434,6 @@ void Session::on_handshake_ready(Result<unique_ptr<mtproto::AuthKeyHandshake>> r
if (auth_data_.update_server_time_difference(handshake->get_server_time_diff())) { if (auth_data_.update_server_time_difference(handshake->get_server_time_diff())) {
on_server_time_difference_updated(); on_server_time_difference_updated();
} }
LOG(INFO) << "Got " << (is_main ? "main" : "tmp") << " auth key";
} }
} }

View File

@ -63,7 +63,7 @@ inline Status from_json(int32 &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Number, got " << from.type()); return Status::Error(PSLICE() << "Expected Number, but receive " << from.type());
} }
Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number(); Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number();
TRY_RESULT_ASSIGN(to, to_integer_safe<int32>(number)); TRY_RESULT_ASSIGN(to, to_integer_safe<int32>(number));
@ -82,7 +82,7 @@ inline Status from_json(bool &to, JsonValue from) {
to = x != 0; to = x != 0;
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Boolean, got " << from_type); return Status::Error(PSLICE() << "Expected Boolean, but receive " << from_type);
} }
to = from.get_boolean(); to = from.get_boolean();
return Status::OK(); return Status::OK();
@ -93,7 +93,7 @@ inline Status from_json(int64 &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected String or Number, got " << from.type()); return Status::Error(PSLICE() << "Expected String or Number, but receive " << from.type());
} }
Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number(); Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number();
TRY_RESULT_ASSIGN(to, to_integer_safe<int64>(number)); TRY_RESULT_ASSIGN(to, to_integer_safe<int64>(number));
@ -105,7 +105,7 @@ inline Status from_json(double &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Number, got " << from.type()); return Status::Error(PSLICE() << "Expected Number, but receive " << from.type());
} }
to = to_double(from.get_number()); to = to_double(from.get_number());
return Status::OK(); return Status::OK();
@ -116,7 +116,7 @@ inline Status from_json(string &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected String, got " << from.type()); return Status::Error(PSLICE() << "Expected String, but receive " << from.type());
} }
to = from.get_string().str(); to = from.get_string().str();
return Status::OK(); return Status::OK();
@ -127,7 +127,7 @@ inline Status from_json_bytes(string &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected String, got " << from.type()); return Status::Error(PSLICE() << "Expected String, but receive " << from.type());
} }
TRY_RESULT_ASSIGN(to, base64_decode(from.get_string())); TRY_RESULT_ASSIGN(to, base64_decode(from.get_string()));
return Status::OK(); return Status::OK();
@ -139,7 +139,7 @@ Status from_json(std::vector<T> &to, JsonValue from) {
if (from.type() == JsonValue::Type::Null) { if (from.type() == JsonValue::Type::Null) {
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Array, got " << from.type()); return Status::Error(PSLICE() << "Expected Array, but receive " << from.type());
} }
to = std::vector<T>(from.get_array().size()); to = std::vector<T>(from.get_array().size());
size_t i = 0; size_t i = 0;
@ -157,7 +157,7 @@ std::enable_if_t<!std::is_constructible<T>::value, Status> from_json(tl_object_p
to = nullptr; to = nullptr;
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Object, got " << from.type()); return Status::Error(PSLICE() << "Expected Object, but receive " << from.type());
} }
auto &object = from.get_object(); auto &object = from.get_object();
@ -168,7 +168,7 @@ std::enable_if_t<!std::is_constructible<T>::value, Status> from_json(tl_object_p
} else if (constructor_value.type() == JsonValue::Type::String) { } else if (constructor_value.type() == JsonValue::Type::String) {
TRY_RESULT_ASSIGN(constructor, tl_constructor_from_string(to.get(), constructor_value.get_string().str())); TRY_RESULT_ASSIGN(constructor, tl_constructor_from_string(to.get(), constructor_value.get_string().str()));
} else { } else {
return Status::Error(PSLICE() << "Expected String or Integer, got " << constructor_value.type()); return Status::Error(PSLICE() << "Expected String or Integer, but receive " << constructor_value.type());
} }
TlDowncastHelper<T> helper(constructor); TlDowncastHelper<T> helper(constructor);
@ -193,7 +193,7 @@ std::enable_if_t<std::is_constructible<T>::value, Status> from_json(tl_object_pt
to = nullptr; to = nullptr;
return Status::OK(); return Status::OK();
} }
return Status::Error(PSLICE() << "Expected Object, got " << from.type()); return Status::Error(PSLICE() << "Expected Object, but receive " << from.type());
} }
to = make_tl_object<T>(); to = make_tl_object<T>();
return from_json(*to, from.get_object()); return from_json(*to, from.get_object());

View File

@ -13,7 +13,7 @@
class Worker final : public td::Actor { class Worker final : public td::Actor {
public: public:
void ping(int x) { void ping(int x) {
LOG(ERROR) << "Got ping " << x; LOG(ERROR) << "Receive ping " << x;
} }
}; };

View File

@ -183,7 +183,7 @@ Status SqliteStatement::step() {
auto rc = tdsqlite3_step(stmt_.get()); auto rc = tdsqlite3_step(stmt_.get());
VLOG(sqlite) << "Finish step with response " << (rc == SQLITE_ROW ? "ROW" : (rc == SQLITE_DONE ? "DONE" : "ERROR")); VLOG(sqlite) << "Finish step with response " << (rc == SQLITE_ROW ? "ROW" : (rc == SQLITE_DONE ? "DONE" : "ERROR"));
if (rc == SQLITE_ROW) { if (rc == SQLITE_ROW) {
state_ = State::GotRow; state_ = State::HaveRow;
return Status::OK(); return Status::OK();
} }

View File

@ -51,7 +51,7 @@ class SqliteStatement {
return state_ != State::Finish; return state_ != State::Finish;
} }
bool has_row() const { bool has_row() const {
return state_ == State::GotRow; return state_ == State::HaveRow;
} }
bool empty() const { bool empty() const {
return !stmt_; return !stmt_;
@ -76,7 +76,7 @@ class SqliteStatement {
void operator()(tdsqlite3_stmt *stmt); void operator()(tdsqlite3_stmt *stmt);
}; };
enum class State { Start, GotRow, Finish }; enum class State { Start, HaveRow, Finish };
State state_ = State::Start; State state_ = State::Start;
std::unique_ptr<tdsqlite3_stmt, StmtDeleter> stmt_; std::unique_ptr<tdsqlite3_stmt, StmtDeleter> stmt_;

View File

@ -316,7 +316,7 @@ class MpmcQueueOld {
std::atomic<Node *> next_{nullptr}; std::atomic<Node *> next_{nullptr};
char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
MpmcQueueBlock<T> block; MpmcQueueBlock<T> block;
//Got pad in MpmcQueueBlock // MpmcQueueBlock is already padded
}; };
std::atomic<Node *> write_pos_{nullptr}; std::atomic<Node *> write_pos_{nullptr};
char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
@ -324,7 +324,7 @@ class MpmcQueueOld {
char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
size_t block_size_; size_t block_size_;
HazardPointers<Node, 1> hazard_pointers_; HazardPointers<Node, 1> hazard_pointers_;
//Got pad in HazardPointers // HazardPointers is already padded
}; };
template <class T> template <class T>
@ -448,14 +448,13 @@ class MpmcQueue {
Block block; Block block;
std::atomic<Node *> next{nullptr}; std::atomic<Node *> next{nullptr};
char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
//Got pad in MpmcQueueBlock
}; };
std::atomic<Node *> write_pos_{nullptr}; std::atomic<Node *> write_pos_{nullptr};
char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
std::atomic<Node *> read_pos_{nullptr}; std::atomic<Node *> read_pos_{nullptr};
char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)]; char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic<Node *>)];
HazardPointers<Node, 1> hazard_pointers_; HazardPointers<Node, 1> hazard_pointers_;
//Got pad in HazardPointers // HazardPointers is already padded
}; };
} // namespace td } // namespace td

View File

@ -281,16 +281,16 @@ class MpmcSleepyWaiter {
auto view = StateView(state_.load()); auto view = StateView(state_.load());
//LOG(ERROR) << view.parked_count; //LOG(ERROR) << view.parked_count;
if (view.searching_count > 0 || view.parked_count == 0) { if (view.searching_count > 0 || view.parked_count == 0) {
VLOG(waiter) << "Ingore notify: " << view.searching_count << " " << view.parked_count; VLOG(waiter) << "Ingore notify: " << view.searching_count << ' ' << view.parked_count;
return; return;
} }
VLOG(waiter) << "Notify: " << view.searching_count << " " << view.parked_count; VLOG(waiter) << "Notify: " << view.searching_count << ' ' << view.parked_count;
std::unique_lock<std::mutex> guard(sleepers_mutex_); std::unique_lock<std::mutex> guard(sleepers_mutex_);
view = StateView(state_.load()); view = StateView(state_.load());
if (view.searching_count > 0) { if (view.searching_count > 0) {
VLOG(waiter) << "Skip notify: got searching"; VLOG(waiter) << "Skip notify: search is active";
return; return;
} }

View File

@ -27,7 +27,7 @@ void Iocp::loop() {
BOOL ok = BOOL ok =
GetQueuedCompletionStatus(iocp_handle_->fd(), &bytes, &key, reinterpret_cast<OVERLAPPED **>(&overlapped), 1000); GetQueuedCompletionStatus(iocp_handle_->fd(), &bytes, &key, reinterpret_cast<OVERLAPPED **>(&overlapped), 1000);
if (bytes || key || overlapped) { if (bytes || key || overlapped) {
// LOG(ERROR) << "Got IOCP " << bytes << " " << key << " " << overlapped; // LOG(ERROR) << "Receive IOCP completion status: " << bytes << ' ' << key << ' ' << overlapped;
} }
if (ok) { if (ok) {
auto callback = reinterpret_cast<Iocp::Callback *>(key); auto callback = reinterpret_cast<Iocp::Callback *>(key);

View File

@ -441,7 +441,7 @@ static void test_to_double_one(td::CSlice str, td::Slice expected, int precision
auto result = PSTRING() << td::StringBuilder::FixedDouble(to_double(str), precision); auto result = PSTRING() << td::StringBuilder::FixedDouble(to_double(str), precision);
if (expected != result) { if (expected != result) {
LOG(ERROR) << "To double conversion failed: have " << str << ", expected " << expected << ", parsed " LOG(ERROR) << "To double conversion failed: have " << str << ", expected " << expected << ", parsed "
<< to_double(str) << ", got " << result; << to_double(str) << ", receive " << result;
} }
} }
@ -517,7 +517,8 @@ TEST(Misc, print_uint) {
static void test_idn_to_ascii_one(const td::string &host, const td::string &result) { static void test_idn_to_ascii_one(const td::string &host, const td::string &result) {
if (result != td::idn_to_ascii(host).ok()) { if (result != td::idn_to_ascii(host).ok()) {
LOG(ERROR) << "Failed to convert " << host << " to " << result << ", got \"" << td::idn_to_ascii(host).ok() << "\""; LOG(ERROR) << "Failed to convert " << host << " to " << result << ", receive \"" << td::idn_to_ascii(host).ok()
<< "\"";
} }
} }
@ -835,9 +836,9 @@ TEST(Misc, StringBuilder) {
if (use_buf) { if (use_buf) {
ASSERT_EQ(res, sb.as_cslice()); ASSERT_EQ(res, sb.as_cslice());
} else { } else {
auto got = sb.as_cslice(); auto sb_result = sb.as_cslice();
res.resize(got.size()); res.resize(sb_result.size());
ASSERT_EQ(res, got); ASSERT_EQ(res, sb_result);
} }
} }
} }

View File

@ -241,7 +241,7 @@ class TestPingActor final : public td::Actor {
return stop(); return stop();
} }
if (ping_connection_->was_pong()) { if (ping_connection_->was_pong()) {
LOG(INFO) << "GOT PONG"; LOG(INFO) << "Receive pong";
return stop(); return stop();
} }
} }

View File

@ -321,7 +321,7 @@ class UploadFile : public Task {
auto r_id = read_file(id_path_); auto r_id = read_file(id_path_);
if (r_id.is_ok() && r_id.ok().size() > 10) { if (r_id.is_ok() && r_id.ok().size() > 10) {
auto id = r_id.move_as_ok(); auto id = r_id.move_as_ok();
LOG(ERROR) << "Got file from cache"; LOG(ERROR) << "Receive file from cache";
Result res; Result res;
res.content = std::move(content_); res.content = std::move(content_);
res.remote_id = id.as_slice().str(); res.remote_id = id.as_slice().str();
@ -437,12 +437,12 @@ class TestDownloadFile : public Task {
start_chunk(); start_chunk();
} }
void got_chunk(const td_api::file &file) { void on_get_chunk(const td_api::file &file) {
LOG(ERROR) << "Got chunk"; LOG(ERROR) << "Receive chunk";
auto range = ranges_.back(); auto range = ranges_.back();
std::string got_chunk(range.end - range.begin, '\0'); std::string received_chunk(range.end - range.begin, '\0');
FileFd::open(file.local_->path_, FileFd::Flags::Read).move_as_ok().pread(got_chunk, range.begin).ensure(); FileFd::open(file.local_->path_, FileFd::Flags::Read).move_as_ok().pread(received_chunk, range.begin).ensure();
CHECK(got_chunk == as_slice(content_).substr(range.begin, range.end - range.begin)); CHECK(received_chunk == as_slice(content_).substr(range.begin, range.end - range.begin));
ranges_.pop_back(); ranges_.pop_back();
if (ranges_.empty()) { if (ranges_.empty()) {
promise_.set_value(Unit{}); promise_.set_value(Unit{});
@ -455,7 +455,7 @@ class TestDownloadFile : public Task {
send_query(td::make_tl_object<td::td_api::downloadFile>( send_query(td::make_tl_object<td::td_api::downloadFile>(
file_id_, 1, static_cast<int64>(ranges_.back().begin), file_id_, 1, static_cast<int64>(ranges_.back().begin),
static_cast<int64>(ranges_.back().end - ranges_.back().begin), true), static_cast<int64>(ranges_.back().end - ranges_.back().begin), true),
[this](auto res) { got_chunk(*res.ok()); }); [this](auto res) { on_get_chunk(*res.ok()); });
} }
}; };

View File

@ -764,11 +764,11 @@ class Master final : public Actor {
bob_ = create_actor<SecretChatProxy>("SecretChatProxy bob", "bob", actor_shared(this, 2)); bob_ = create_actor<SecretChatProxy>("SecretChatProxy bob", "bob", actor_shared(this, 2));
send_closure(alice_.get_actor_unsafe()->actor_, &SecretChatActor::create_chat, UserId(static_cast<int64>(2)), 0, send_closure(alice_.get_actor_unsafe()->actor_, &SecretChatActor::create_chat, UserId(static_cast<int64>(2)), 0,
123, PromiseCreator::lambda([actor_id = actor_id(this)](Result<SecretChatId> res) { 123, PromiseCreator::lambda([actor_id = actor_id(this)](Result<SecretChatId> res) {
send_closure(actor_id, &Master::got_secret_chat_id, std::move(res), false); send_closure(actor_id, &Master::on_get_secret_chat_id, std::move(res), false);
})); }));
} }
void got_secret_chat_id(Result<SecretChatId> res, bool dummy) { void on_get_secret_chat_id(Result<SecretChatId> res, bool dummy) {
CHECK(res.is_ok()); CHECK(res.is_ok());
auto id = res.move_as_ok(); auto id = res.move_as_ok();
LOG(INFO) << "SecretChatId = " << id; LOG(INFO) << "SecretChatId = " << id;
@ -825,7 +825,7 @@ class Master final : public Actor {
} }
void process_net_query(my_api::messages_getDhConfig &&get_dh_config, NetQueryPtr net_query, void process_net_query(my_api::messages_getDhConfig &&get_dh_config, NetQueryPtr net_query,
ActorShared<NetQueryCallback> callback) { ActorShared<NetQueryCallback> callback) {
//LOG(INFO) << "Got query " << to_string(get_dh_config); //LOG(INFO) << "Receive query " << to_string(get_dh_config);
my_api::messages_dhConfig config; my_api::messages_dhConfig config;
config.p_ = BufferSlice(base64url_decode(prime_base64).move_as_ok()); config.p_ = BufferSlice(base64url_decode(prime_base64).move_as_ok());
config.g_ = g; config.g_ = g;
@ -914,7 +914,7 @@ class Master final : public Actor {
int32 last_ping_ = std::numeric_limits<int32>::max(); int32 last_ping_ = std::numeric_limits<int32>::max();
void on_inbound_message(string message, Promise<> promise) { void on_inbound_message(string message, Promise<> promise) {
promise.set_value(Unit()); promise.set_value(Unit());
LOG(INFO) << "GOT INBOUND MESSAGE: " << message << " " << get_link_token(); LOG(INFO) << "Receive inbound message: " << message << " " << get_link_token();
int32 cnt; int32 cnt;
int x = std::sscanf(message.c_str(), "PING: %d", &cnt); int x = std::sscanf(message.c_str(), "PING: %d", &cnt);
if (x != 1) { if (x != 1) {
@ -967,7 +967,7 @@ class Master final : public Actor {
std::map<int64, Message> sent_messages_; std::map<int64, Message> sent_messages_;
void hangup_shared() final { void hangup_shared() final {
LOG(INFO) << "GOT HANGUP: " << get_link_token(); LOG(INFO) << "Receive hang up: " << get_link_token();
send_closure(from(), &SecretChatProxy::on_closed); send_closure(from(), &SecretChatProxy::on_closed);
} }
}; };

View File

@ -146,7 +146,7 @@ class TestClient final : public td::Actor {
td::rmrf(name_).ignore(); td::rmrf(name_).ignore();
auto old_context = set_context(std::make_shared<td::ActorContext>()); auto old_context = set_context(std::make_shared<td::ActorContext>());
set_tag(name_); set_tag(name_);
LOG(INFO) << "START UP!"; LOG(INFO) << "Start up!";
td_client_ = td::create_actor<td::ClientActor>("Td-proxy", make_td_callback()); td_client_ = td::create_actor<td::ClientActor>("Td-proxy", make_td_callback());
} }
@ -251,7 +251,7 @@ class DoAuthentication final : public TestClinetTask {
send_query(std::move(function), [](auto res) { LOG_CHECK(res->get_id() == td::td_api::ok::ID) << to_string(res); }); send_query(std::move(function), [](auto res) { LOG_CHECK(res->get_id() == td::td_api::ok::ID) << to_string(res); });
} }
void on_authorization_ready() { void on_authorization_ready() {
LOG(INFO) << "GOT AUTHORIZED"; LOG(INFO) << "Authorization is completed";
stop(); stop();
} }
@ -294,7 +294,7 @@ class SetUsername final : public TestClinetTask {
self_id_ = user->id_; self_id_ = user->id_;
auto current_username = user->usernames_ != nullptr ? user->usernames_->editable_username_ : td::string(); auto current_username = user->usernames_ != nullptr ? user->usernames_->editable_username_ : td::string();
if (current_username != username_) { if (current_username != username_) {
LOG(INFO) << "SET USERNAME: " << username_; LOG(INFO) << "Set username: " << username_;
send_query(td::make_tl_object<td::td_api::setUsername>(username_), [this](auto res) { send_query(td::make_tl_object<td::td_api::setUsername>(username_), [this](auto res) {
CHECK(res->get_id() == td::td_api::ok::ID); CHECK(res->get_id() == td::td_api::ok::ID);
this->send_self_message(); this->send_self_message();
@ -330,7 +330,7 @@ class SetUsername final : public TestClinetTask {
auto messageText = td::move_tl_object_as<td::td_api::messageText>(message->content_); auto messageText = td::move_tl_object_as<td::td_api::messageText>(message->content_);
auto text = messageText->text_->text_; auto text = messageText->text_->text_;
if (text.substr(0, tag_.size()) == tag_) { if (text.substr(0, tag_.size()) == tag_) {
LOG(INFO) << "GOT SELF MESSAGE"; LOG(INFO) << "Receive self-message";
return stop(); return stop();
} }
} }
@ -360,7 +360,7 @@ class CheckTestA final : public TestClinetTask {
LOG_CHECK(text > previous_text_) << td::tag("now", text) << td::tag("previous", previous_text_); LOG_CHECK(text > previous_text_) << td::tag("now", text) << td::tag("previous", previous_text_);
previous_text_ = text; previous_text_ = text;
cnt_--; cnt_--;
LOG(INFO) << "GOT " << td::tag("text", text) << td::tag("left", cnt_); LOG(INFO) << "Receive " << td::tag("text", text) << td::tag("left", cnt_);
if (cnt_ == 0) { if (cnt_ == 0) {
return stop(); return stop();
} }
@ -427,7 +427,7 @@ class TestSecretChat final : public TestClinetTask {
update_secret_chat->secret_chat_->state_->get_id() != td::td_api::secretChatStateReady::ID) { update_secret_chat->secret_chat_->state_->get_id() != td::td_api::secretChatStateReady::ID) {
return; return;
} }
LOG(INFO) << "SEND ENCRYPTED MESSAGES"; LOG(INFO) << "Send encrypted messages";
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
send_query( send_query(
td::make_tl_object<td::td_api::sendMessage>( td::make_tl_object<td::td_api::sendMessage>(
@ -482,7 +482,7 @@ class TestFileGenerated final : public TestClinetTask {
} }
void one_file() { void one_file() {
LOG(ERROR) << "Start ONE_FILE test"; LOG(ERROR) << "Start one_file test";
auto file_path = PSTRING() << "test_documents" << TD_DIR_SLASH << "a.txt"; auto file_path = PSTRING() << "test_documents" << TD_DIR_SLASH << "a.txt";
td::mkpath(file_path).ensure(); td::mkpath(file_path).ensure();
auto raw_file = auto raw_file =
@ -554,7 +554,7 @@ class TestFileGenerated final : public TestClinetTask {
} }
} }
auto ready = std::ftell(to); auto ready = std::ftell(to);
LOG(ERROR) << "READY: " << ready; LOG(ERROR) << "Ready: " << ready;
parent_->send_query(td::make_tl_object<td::td_api::setFileGenerationProgress>( parent_->send_query(td::make_tl_object<td::td_api::setFileGenerationProgress>(
id_, 1039823 /*yeah, exact size of this file*/, td::narrow_cast<td::int32>(ready)), id_, 1039823 /*yeah, exact size of this file*/, td::narrow_cast<td::int32>(ready)),
[](auto result) { check_td_error(result); }); [](auto result) { check_td_error(result); });
@ -631,7 +631,7 @@ class CheckTestC final : public TestClinetTask {
auto text = messageDocument->caption_->text_; auto text = messageDocument->caption_->text_;
if (text.substr(0, tag_.size()) == tag_) { if (text.substr(0, tag_.size()) == tag_) {
file_id_to_check_ = messageDocument->document_->document_->id_; file_id_to_check_ = messageDocument->document_->document_->id_;
LOG(ERROR) << "GOT FILE " << to_string(messageDocument->document_->document_); LOG(ERROR) << "Receive file " << to_string(messageDocument->document_->document_);
send_query(td::make_tl_object<td::td_api::downloadFile>(file_id_to_check_, 1, 0, 0, false), send_query(td::make_tl_object<td::td_api::downloadFile>(file_id_to_check_, 1, 0, 0, false),
[](auto res) { check_td_error(res); }); [](auto res) { check_td_error(res); });
} }