Use LOG_CHECK where it is necessary

GitOrigin-RevId: a8bd17cc2ee6e43dcea52bb25aef9ee1f91c7ec4
This commit is contained in:
Arseny Smirnov 2019-02-12 19:17:20 +03:00
parent 281b4ab57a
commit 20bfcaa979
58 changed files with 161 additions and 158 deletions

View File

@ -27,7 +27,7 @@ class HttpClient : public HttpOutboundConnection::Callback {
IPAddress addr;
addr.init_ipv4_port("127.0.0.1", 8082).ensure();
auto fd = SocketFd::open(addr);
CHECK(fd.is_ok()) << fd.error();
LOG_CHECK(fd.is_ok()) << fd.error();
connection_ = create_actor<HttpOutboundConnection>("Connect", fd.move_as_ok(), SslStream{},
std::numeric_limits<size_t>::max(), 0, 0,
ActorOwn<HttpOutboundConnection::Callback>(actor_id(this)));

View File

@ -72,7 +72,7 @@ void Transport::write(BufferWriter &&message, bool quick_ack) {
Slice src = r_head.ok();
// LOG(DEBUG) << src;
MutableSlice dst = message.prepare_prepend();
CHECK(dst.size() >= src.size()) << dst.size() << " >= " << src.size();
LOG_CHECK(dst.size() >= src.size()) << dst.size() << " >= " << src.size();
std::memcpy(dst.end() - src.size(), src.begin(), src.size());
message.confirm_prepend(src.size());
output_->append(message.as_buffer_slice());

View File

@ -74,7 +74,7 @@ Status RawConnection::flush_read(const AuthKey &auth_key, Callback &callback) {
new_packet.as_slice().copy_from(packet.as_slice());
packet = std::move(new_packet);
}
CHECK(is_aligned_pointer<4>(packet.as_slice().ubegin()))
LOG_CHECK(is_aligned_pointer<4>(packet.as_slice().ubegin()))
<< packet.as_slice().ubegin() << ' ' << packet.size() << ' ' << wait_size;
if (wait_size != 0) {
constexpr size_t MAX_PACKET_SIZE = (1 << 22) + 1024;

View File

@ -742,7 +742,7 @@ void SessionConnection::send_crypto(const Storer &storer, uint64 quick_ack_token
Result<uint64> SessionConnection::send_query(BufferSlice buffer, bool gzip_flag, int64 message_id,
uint64 invoke_after_id, bool use_quick_ack) {
CHECK(mode_ != Mode::HttpLongPoll) << "LongPoll connection is only for http_wait";
LOG_CHECK(mode_ != Mode::HttpLongPoll) << "LongPoll connection is only for http_wait";
if (message_id == 0) {
message_id = auth_data_->next_message_id(Time::now_cached());
}

View File

@ -151,7 +151,7 @@ tl_object_ptr<td_api::animation> AnimationsManager::get_animation_object(FileId
}
auto &animation = animations_[file_id];
CHECK(animation != nullptr) << source << " " << file_id << " "
LOG_CHECK(animation != nullptr) << source << " " << file_id << " "
<< static_cast<int32>(td_->file_manager_->get_file_view(file_id).get_type());
// TODO can we make that function const?
animation->is_changed = false;
@ -589,7 +589,7 @@ int32 AnimationsManager::get_saved_animations_hash(const char *source) const {
CHECK(animation != nullptr);
auto file_view = td_->file_manager_->get_file_view(animation_id);
CHECK(file_view.has_remote_location());
CHECK(file_view.remote_location().is_document()) << source << " " << file_view.remote_location();
LOG_CHECK(file_view.remote_location().is_document()) << source << " " << file_view.remote_location();
auto id = static_cast<uint64>(file_view.remote_location().get_id());
numbers.push_back(static_cast<uint32>(id >> 32));
numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF));
@ -619,7 +619,7 @@ void AnimationsManager::send_save_gif_query(FileId animation_id, bool unsave, Pr
// TODO invokeAfter and log event
auto file_view = td_->file_manager_->get_file_view(animation_id);
CHECK(file_view.has_remote_location());
CHECK(file_view.remote_location().is_document()) << file_view.remote_location();
LOG_CHECK(file_view.remote_location().is_document()) << file_view.remote_location();
CHECK(!file_view.remote_location().is_web());
td_->create_handler<SaveGifQuery>(std::move(promise))
->send(animation_id, file_view.remote_location().as_input_document(), unsave);

View File

@ -312,7 +312,7 @@ Status CallActor::do_update_call(telegram_api::phoneCallRequested &call) {
}
tl_object_ptr<telegram_api::inputPhoneCall> CallActor::get_input_phone_call(const char *source) {
CHECK(is_call_id_inited_) << source;
LOG_CHECK(is_call_id_inited_) << source;
return make_tl_object<telegram_api::inputPhoneCall>(call_id_, call_access_hash_);
}

View File

@ -5208,7 +5208,7 @@ void ContactsManager::on_binlog_user_event(BinlogEvent &&event) {
binlog_erase(G()->td_db()->get_binlog(), event.id_);
return; // TODO fix bug in Binlog and remove that fix
}
CHECK(u->first_name.empty() && u->last_name.empty()) << user_id << " " << u->debug_source;
LOG_CHECK(u->first_name.empty() && u->last_name.empty()) << user_id << " " << u->debug_source;
*u = std::move(log_event.u); // users come from binlog before all other events, so just add them
u->logevent_id = event.id_;
@ -5257,7 +5257,7 @@ void ContactsManager::save_user_to_database_impl(User *u, UserId user_id, string
void ContactsManager::on_save_user_to_database(UserId user_id, bool success) {
User *u = get_user(user_id);
CHECK(u != nullptr);
CHECK(u->is_being_saved) << user_id << " " << u->is_saved << " " << u->is_status_saved << " "
LOG_CHECK(u->is_being_saved) << user_id << " " << u->is_saved << " " << u->is_status_saved << " "
<< load_user_from_database_queries_.count(user_id) << " " << u->is_received << " "
<< u->is_deleted << " " << u->is_bot << " " << u->is_changed << " " << u->need_send_update
<< " " << u->is_status_changed << " " << u->is_name_changed << " " << u->is_username_changed
@ -5691,7 +5691,7 @@ void ContactsManager::on_binlog_channel_event(BinlogEvent &&event) {
binlog_erase(G()->td_db()->get_binlog(), event.id_);
return; // TODO fix bug in Binlog and remove that fix
}
CHECK(c->status.is_banned()) << channel_id << " " << c->debug_source;
LOG_CHECK(c->status.is_banned()) << channel_id << " " << c->debug_source;
*c = std::move(log_event.c); // channels come from binlog before all other events, so just add them
c->logevent_id = event.id_;

View File

@ -52,7 +52,7 @@ tl_object_ptr<td_api::document> DocumentsManager::get_document_object(FileId fil
LOG(INFO) << "Return document " << file_id << " object";
auto &document = documents_[file_id];
CHECK(document != nullptr) << tag("file_id", file_id);
LOG_CHECK(document != nullptr) << tag("file_id", file_id);
document->is_changed = false;
return make_tl_object<td_api::document>(document->file_name, document->mime_type,
get_photo_size_object(td_->file_manager_.get(), &document->thumbnail),

View File

@ -1661,7 +1661,7 @@ vector<tl_object_ptr<telegram_api::MessageEntity>> get_input_message_entities(co
break;
case MessageEntity::Type::MentionName: {
auto input_user = contacts_manager->get_input_user(entity.user_id);
CHECK(input_user != nullptr) << source;
LOG_CHECK(input_user != nullptr) << source;
result.push_back(make_tl_object<telegram_api::inputMessageEntityMentionName>(entity.offset, entity.length,
std::move(input_user)));
break;

View File

@ -431,7 +431,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
MessageId last_message_id, int32 date) override {
int64 left_message_id = first_message_id.get();
int64 right_message_id = last_message_id.get();
CHECK(left_message_id <= right_message_id) << first_message_id << " " << last_message_id;
LOG_CHECK(left_message_id <= right_message_id) << first_message_id << " " << last_message_id;
TRY_RESULT(first_messages,
get_messages_inner(get_messages_stmt_.asc_stmt_, dialog_id.get(), left_message_id - 1, 1));
if (!first_messages.empty()) {
@ -661,7 +661,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
Result<std::vector<BufferSlice>> get_messages_from_index(DialogId dialog_id, MessageId from_message_id,
int32 index_mask, int32 offset, int32 limit) {
CHECK(index_mask != 0);
CHECK(index_mask < (1 << MESSAGES_DB_INDEX_COUNT)) << tag("index_mask", index_mask);
LOG_CHECK(index_mask < (1 << MESSAGES_DB_INDEX_COUNT)) << tag("index_mask", index_mask);
int index_i = -1;
for (int i = 0; i < MESSAGES_DB_INDEX_COUNT; i++) {
if (index_mask == (1 << i)) {
@ -679,7 +679,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
Result<MessagesDbCallsResult> get_calls(MessagesDbCallsQuery query) override {
CHECK(query.index_mask != 0);
CHECK(query.index_mask < (1 << MESSAGES_DB_INDEX_COUNT)) << tag("index_mask", query.index_mask);
LOG_CHECK(query.index_mask < (1 << MESSAGES_DB_INDEX_COUNT)) << tag("index_mask", query.index_mask);
int index_i = -1;
for (int i = 0; i < MESSAGES_DB_INDEX_COUNT; i++) {
if (query.index_mask == (1 << i)) {
@ -754,7 +754,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
Result<std::vector<BufferSlice>> get_messages_impl(GetMessagesStmt &stmt, DialogId dialog_id,
MessageId from_message_id, int32 offset, int32 limit) {
CHECK(dialog_id.is_valid()) << dialog_id;
LOG_CHECK(dialog_id.is_valid()) << dialog_id;
CHECK(from_message_id.is_valid());
LOG(INFO) << "Loading messages in " << dialog_id << " from " << from_message_id << " with offset = " << offset

View File

@ -3872,7 +3872,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
parser.set_error("Wrong first_database_message_id_by_index table size");
return;
}
CHECK(static_cast<size_t>(size) <= first_database_message_id_by_index.size())
LOG_CHECK(static_cast<size_t>(size) <= first_database_message_id_by_index.size())
<< size << " " << first_database_message_id_by_index.size();
for (int32 i = 0; i < size; i++) {
parse(first_database_message_id_by_index[i], parser);
@ -3938,7 +3938,7 @@ void MessagesManager::CallsDbState::parse(ParserT &parser) {
using td::parse;
int32 size;
parse(size, parser);
CHECK(static_cast<size_t>(size) <= first_calls_database_message_id_by_index.size())
LOG_CHECK(static_cast<size_t>(size) <= first_calls_database_message_id_by_index.size())
<< size << " " << first_calls_database_message_id_by_index.size();
for (int32 i = 0; i < size; i++) {
parse(first_calls_database_message_id_by_index[i], parser);
@ -5002,7 +5002,7 @@ bool MessagesManager::update_message_views(DialogId dialog_id, Message *m, int32
bool MessagesManager::update_message_contains_unread_mention(Dialog *d, Message *m, bool contains_unread_mention,
const char *source) {
CHECK(m != nullptr) << source;
LOG_CHECK(m != nullptr) << source;
if (!contains_unread_mention && m->contains_unread_mention) {
remove_message_notification_id(d, m, true); // should be called before contains_unread_mention is updated
@ -5368,7 +5368,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
if (d == nullptr || pts_count > 0) {
process_channel_update(std::move(update));
CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
LOG_CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
} else {
LOG_IF(INFO, update->get_id() != dummyUpdate::ID)
<< "Skip useless channel update from " << source << ": " << to_string(update);
@ -5583,7 +5583,7 @@ bool MessagesManager::update_dialog_notification_settings(DialogId dialog_id,
if (is_changed) {
Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr) << "Wrong " << dialog_id << " in update_dialog_notification_settings";
LOG_CHECK(d != nullptr) << "Wrong " << dialog_id << " in update_dialog_notification_settings";
bool was_muted = is_dialog_muted(d);
bool was_dialog_mentions_disabled = is_dialog_mention_notifications_disabled(d);
update_dialog_unmute_timeout(d, current_settings->use_default_mute_until, current_settings->mute_until,
@ -6733,7 +6733,7 @@ void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_
}
is_dialog_updated = true;
} else {
CHECK(d->last_new_message_id.is_valid())
LOG_CHECK(d->last_new_message_id.is_valid())
<< dialog_id << " " << from_the_end << " " << d->first_database_message_id << " "
<< d->last_database_message_id << " " << first_added_message_id << " " << last_added_message_id << " "
<< d->last_message_id << " " << d->last_new_message_id << " " << d->have_full_history << " "
@ -6773,7 +6773,7 @@ void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_
}
}
}
CHECK(d->first_database_message_id.is_valid())
LOG_CHECK(d->first_database_message_id.is_valid())
<< dialog_id << " " << from_the_end << " " << d->first_database_message_id << " " << d->last_database_message_id
<< " " << first_added_message_id << " " << last_added_message_id << " " << d->last_message_id << " "
<< d->last_new_message_id << " " << d->have_full_history << " " << prev_last_new_message_id << " "
@ -7952,7 +7952,7 @@ void MessagesManager::read_channel_message_content_from_updates(Dialog *d, Messa
}
bool MessagesManager::read_message_content(Dialog *d, Message *m, bool is_local_read, const char *source) {
CHECK(m != nullptr) << source;
LOG_CHECK(m != nullptr) << source;
bool is_mention_read = update_message_contains_unread_mention(d, m, false, "read_message_content");
bool is_content_read =
update_opened_message_content(m->content.get()) | ttl_on_open(d, m, Time::now(), is_local_read);
@ -8556,7 +8556,8 @@ void MessagesManager::ttl_unregister_message(DialogId dialog_id, const Message *
TtlNode ttl_node(dialog_id, message->message_id);
auto it = ttl_nodes_.find(ttl_node);
CHECK(it != ttl_nodes_.end()) << dialog_id << " " << message->message_id << " " << source << " " << G()->close_flag();
LOG_CHECK(it != ttl_nodes_.end()) << dialog_id << " " << message->message_id << " " << source << " "
<< G()->close_flag();
auto *heap_node = it->as_heap_node();
if (heap_node->in_heap()) {
ttl_heap_.erase(heap_node);
@ -9350,7 +9351,7 @@ void MessagesManager::fix_message_info_dialog_id(MessageInfo &message_info) cons
MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
tl_object_ptr<telegram_api::Message> message_ptr, const char *source) const {
LOG(DEBUG) << "Receive from " << source << " " << to_string(message_ptr);
CHECK(message_ptr != nullptr) << source;
LOG_CHECK(message_ptr != nullptr) << source;
int32 constructor_id = message_ptr->get_id();
MessageInfo message_info;
@ -9758,7 +9759,7 @@ void MessagesManager::set_dialog_last_database_message_id(Dialog *d, MessageId l
}
void MessagesManager::set_dialog_last_new_message_id(Dialog *d, MessageId last_new_message_id, const char *source) {
CHECK(last_new_message_id.get() > d->last_new_message_id.get())
LOG_CHECK(last_new_message_id.get() > d->last_new_message_id.get())
<< last_new_message_id << " " << d->last_new_message_id << " " << source;
CHECK(d->dialog_id.get_type() == DialogType::SecretChat || last_new_message_id.is_server());
if (!d->last_new_message_id.is_valid()) {
@ -9900,7 +9901,7 @@ void MessagesManager::set_dialog_is_pinned(Dialog *d, bool is_pinned) {
if (is_pinned != was_pinned) {
LOG(INFO) << "Set " << d->dialog_id << " is pinned to " << is_pinned;
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_is_pinned";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_is_pinned";
update_dialog_pos(d, false, "set_dialog_is_pinned", false);
DialogDate dialog_date(d->order, d->dialog_id);
send_closure(G()->td(), &Td::send_update,
@ -9917,7 +9918,7 @@ void MessagesManager::set_dialog_reply_markup(Dialog *d, MessageId message_id) {
d->need_restore_reply_markup = false;
if (d->reply_markup_message_id.is_valid() || message_id.is_valid()) {
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_reply_markup";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_reply_markup";
d->reply_markup_message_id = message_id;
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateChatReplyMarkup>(d->dialog_id.get(), message_id.get()));
@ -14410,7 +14411,8 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
added_new_message = true;
}
if (next_message != nullptr && !next_message->have_previous) {
CHECK(m->message_id.get() < next_message->message_id.get()) << m->message_id << ' ' << next_message->message_id;
LOG_CHECK(m->message_id.get() < next_message->message_id.get())
<< m->message_id << ' ' << next_message->message_id;
LOG(INFO) << "Fix have_previous for " << next_message->message_id;
next_message->have_previous = true;
attach_message_to_previous(
@ -14455,7 +14457,7 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
if (last_added_message_id.get() < d->first_database_message_id.get() ||
!d->first_database_message_id.is_valid()) {
CHECK(next_message != nullptr);
CHECK(had_full_history || d->have_full_history)
LOG_CHECK(had_full_history || d->have_full_history)
<< had_full_history << ' ' << d->have_full_history << ' ' << next_message->message_id << ' '
<< last_added_message_id << ' ' << d->first_database_message_id << ' ' << debug_first_message_id << ' '
<< d->last_database_message_id << ' ' << debug_last_database_message_id;
@ -15727,7 +15729,7 @@ void MessagesManager::do_send_message_group(int64 media_album_id) {
pending_message_group_sends_.erase(it);
return;
}
CHECK(request.finished_count == request.message_ids.size())
LOG_CHECK(request.finished_count == request.message_ids.size())
<< request.finished_count << " " << request.message_ids.size();
pending_message_group_sends_.erase(it);
@ -17640,7 +17642,7 @@ Result<MessageId> MessagesManager::add_local_message(
bool need_update_dialog_pos = false;
auto result =
add_message_to_dialog(d, std::move(m), true, &need_update, &need_update_dialog_pos, "add local message");
CHECK(result != nullptr) << message_id << " " << debug_add_message_to_dialog_fail_reason_;
LOG_CHECK(result != nullptr) << message_id << " " << debug_add_message_to_dialog_fail_reason_;
if (is_message_auto_read(dialog_id, result->is_outgoing)) {
if (result->is_outgoing) {
@ -18604,8 +18606,8 @@ void MessagesManager::send_update_message_content(DialogId dialog_id, MessageId
const MessageContent *content, int32 message_date,
bool is_content_secret, const char *source) const {
LOG(INFO) << "Send updateMessageContent for " << message_id << " in " << dialog_id << " from " << source;
CHECK(have_dialog(dialog_id)) << "Send updateMessageContent in unknown " << dialog_id << " from " << source
<< " with load count " << loaded_dialogs_.count(dialog_id);
LOG_CHECK(have_dialog(dialog_id)) << "Send updateMessageContent in unknown " << dialog_id << " from " << source
<< " with load count " << loaded_dialogs_.count(dialog_id);
auto content_object = get_message_content_object(content, td_, message_date, is_content_secret);
send_closure(
G()->td(), &Td::send_update,
@ -18623,7 +18625,7 @@ void MessagesManager::send_update_message_edited(DialogId dialog_id, const Messa
void MessagesManager::send_update_delete_messages(DialogId dialog_id, vector<int64> &&message_ids, bool is_permanent,
bool from_cache) const {
if (!message_ids.empty()) {
CHECK(have_dialog(dialog_id)) << "Wrong " << dialog_id << " in send_update_delete_messages";
LOG_CHECK(have_dialog(dialog_id)) << "Wrong " << dialog_id << " in send_update_delete_messages";
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateDeleteMessages>(dialog_id.get(), std::move(message_ids), is_permanent,
from_cache));
@ -18639,7 +18641,7 @@ void MessagesManager::send_update_new_chat(Dialog *d) {
void MessagesManager::send_update_chat_draft_message(const Dialog *d) {
CHECK(d != nullptr);
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_draft_message";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_draft_message";
on_dialog_updated(d->dialog_id, "send_update_chat_draft_message");
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateChatDraftMessage>(
@ -18654,7 +18656,8 @@ void MessagesManager::send_update_chat_last_message(Dialog *d, const char *sourc
void MessagesManager::send_update_chat_last_message_impl(const Dialog *d, const char *source) const {
CHECK(d != nullptr);
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_last_message from " << source;
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_last_message from "
<< source;
LOG(INFO) << "Send updateChatLastMessage in " << d->dialog_id << " to " << d->last_message_id << " from " << source;
auto update = make_tl_object<td_api::updateChatLastMessage>(
d->dialog_id.get(), get_message_object(d->dialog_id, get_message(d, d->last_message_id)),
@ -18739,7 +18742,8 @@ void MessagesManager::send_update_unread_chat_count(DialogId dialog_id, bool for
void MessagesManager::send_update_chat_read_inbox(const Dialog *d, bool force, const char *source) {
CHECK(d != nullptr);
if (!td_->auth_manager_->is_bot()) {
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_read_inbox from " << source;
LOG_CHECK(d->is_update_new_chat_sent)
<< "Wrong " << d->dialog_id << " in send_update_chat_read_inbox from " << source;
on_dialog_updated(d->dialog_id, source);
if (!force && (running_get_difference_ || running_get_channel_difference(d->dialog_id) ||
get_channel_difference_to_logevent_id_.count(d->dialog_id) != 0)) {
@ -18760,7 +18764,7 @@ void MessagesManager::send_update_chat_read_inbox(const Dialog *d, bool force, c
void MessagesManager::send_update_chat_read_outbox(const Dialog *d) {
CHECK(d != nullptr);
if (!td_->auth_manager_->is_bot()) {
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_read_outbox";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_read_outbox";
on_dialog_updated(d->dialog_id, "send_update_chat_read_outbox");
send_closure(
G()->td(), &Td::send_update,
@ -18771,7 +18775,7 @@ void MessagesManager::send_update_chat_read_outbox(const Dialog *d) {
void MessagesManager::send_update_chat_unread_mention_count(const Dialog *d) {
CHECK(d != nullptr);
if (!td_->auth_manager_->is_bot()) {
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_unread_mention_count";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_unread_mention_count";
LOG(INFO) << "Update unread mention message count in " << d->dialog_id << " to " << d->unread_mention_count;
on_dialog_updated(d->dialog_id, "send_update_chat_unread_mention_count");
send_closure(G()->td(), &Td::send_update,
@ -18903,8 +18907,8 @@ FullMessageId MessagesManager::on_send_message_success(int64 random_id, MessageI
if (date <= 0) {
LOG(ERROR) << "Receive " << new_message_id << " in " << dialog_id << " with wrong date " << date;
} else {
CHECK(sent_message->date > 0) << old_message_id << ' ' << sent_message->message_id << ' ' << sent_message->date
<< ' ' << date;
LOG_CHECK(sent_message->date > 0) << old_message_id << ' ' << sent_message->message_id << ' ' << sent_message->date
<< ' ' << date;
sent_message->date = date;
CHECK(d->last_message_id != old_message_id);
}
@ -18928,8 +18932,8 @@ FullMessageId MessagesManager::on_send_message_success(int64 random_id, MessageI
bool need_update = true;
Message *m = add_message_to_dialog(d, std::move(sent_message), true, &need_update, &need_update_dialog_pos, source);
CHECK(m != nullptr) << dialog_id << " " << have_input_peer(dialog_id, AccessRights::Read) << " "
<< debug_add_message_to_dialog_fail_reason_ << " " << source;
LOG_CHECK(m != nullptr) << dialog_id << " " << have_input_peer(dialog_id, AccessRights::Read) << " "
<< debug_add_message_to_dialog_fail_reason_ << " " << source;
send_update_message_send_succeeded(d, old_message_id, m);
if (need_update_dialog_pos) {
@ -19282,7 +19286,7 @@ MessageId MessagesManager::get_next_message_id(Dialog *d, int32 type) {
int64 base = (last + MessageId::TYPE_MASK + 1) & ~MessageId::TYPE_MASK;
d->last_assigned_message_id = MessageId(base + type);
CHECK(d->last_assigned_message_id.is_valid()) << d->last_assigned_message_id;
LOG_CHECK(d->last_assigned_message_id.is_valid()) << d->last_assigned_message_id;
return d->last_assigned_message_id;
}
@ -19333,8 +19337,8 @@ void MessagesManager::fail_send_message(FullMessageId full_message_id, int error
bool need_update = false;
Message *m = add_message_to_dialog(dialog_id, std::move(message), false, &need_update, &need_update_dialog_pos,
"fail_send_message");
CHECK(m != nullptr) << "Failed to add failed to send " << new_message_id << " to " << dialog_id << " due to "
<< debug_add_message_to_dialog_fail_reason_;
LOG_CHECK(m != nullptr) << "Failed to add failed to send " << new_message_id << " to " << dialog_id << " due to "
<< debug_add_message_to_dialog_fail_reason_;
LOG(INFO) << "Send updateMessageSendFailed for " << full_message_id;
d->yet_unsent_message_id_to_persistent_message_id.emplace(old_message_id, m->message_id);
@ -19475,7 +19479,7 @@ void MessagesManager::set_dialog_is_marked_as_unread(Dialog *d, bool is_marked_a
on_dialog_updated(d->dialog_id, "set_dialog_is_marked_as_unread");
LOG(INFO) << "Set " << d->dialog_id << " is marked as unread to " << is_marked_as_unread;
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_is_marked_as_unread";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_is_marked_as_unread";
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateChatIsMarkedAsUnread>(d->dialog_id.get(), is_marked_as_unread));
@ -19523,7 +19527,7 @@ void MessagesManager::set_dialog_pinned_message_id(Dialog *d, MessageId pinned_m
on_dialog_updated(d->dialog_id, "set_dialog_pinned_message_id");
LOG(INFO) << "Set " << d->dialog_id << " pinned message to " << pinned_message_id;
CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_pinned_message_id";
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_pinned_message_id";
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateChatPinnedMessage>(d->dialog_id.get(), pinned_message_id.get()));
}
@ -21419,7 +21423,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
}
// there must be no two recursive calls to add_message_to_dialog
CHECK(!d->being_added_message_id.is_valid()) << d->being_added_message_id << " " << message_id << " " << source;
LOG_CHECK(!d->being_added_message_id.is_valid()) << d->being_added_message_id << " " << message_id << " " << source;
d->being_added_message_id = message_id;
if (d->new_secret_chat_notification_id.is_valid()) {
@ -21865,7 +21869,7 @@ void MessagesManager::add_message_to_database(const Dialog *d, const Message *m,
CHECK(d != nullptr);
CHECK(m != nullptr);
MessageId message_id = m->message_id;
CHECK(message_id.is_server() || message_id.is_local()) << source;
LOG_CHECK(message_id.is_server() || message_id.is_local()) << source;
LOG(INFO) << "Add " << FullMessageId(d->dialog_id, message_id) << " to database from " << source;
@ -22076,9 +22080,9 @@ void MessagesManager::attach_message_to_previous(Dialog *d, MessageId message_id
Message *message = *it;
CHECK(message != nullptr);
CHECK(message->message_id == message_id);
CHECK(message->have_previous) << d->dialog_id << " " << message_id << " " << source;
LOG_CHECK(message->have_previous) << d->dialog_id << " " << message_id << " " << source;
--it;
CHECK(*it != nullptr) << d->dialog_id << " " << message_id << " " << source;
LOG_CHECK(*it != nullptr) << d->dialog_id << " " << message_id << " " << source;
LOG(INFO) << "Attach " << message_id << " to the previous " << (*it)->message_id;
if ((*it)->have_next) {
message->have_next = true;
@ -22093,9 +22097,9 @@ void MessagesManager::attach_message_to_next(Dialog *d, MessageId message_id, co
Message *message = *it;
CHECK(message != nullptr);
CHECK(message->message_id == message_id);
CHECK(message->have_next) << d->dialog_id << " " << message_id << " " << source;
LOG_CHECK(message->have_next) << d->dialog_id << " " << message_id << " " << source;
++it;
CHECK(*it != nullptr) << d->dialog_id << " " << message_id << " " << source;
LOG_CHECK(*it != nullptr) << d->dialog_id << " " << message_id << " " << source;
LOG(INFO) << "Attach " << message_id << " to the next " << (*it)->message_id;
if ((*it)->have_previous) {
message->have_previous = true;
@ -22472,16 +22476,16 @@ MessageId MessagesManager::get_message_id_by_random_id(Dialog *d, int64 random_i
debug_add_message_to_dialog_fail_reason_ = "not called";
Message *m = on_get_message_from_database(d->dialog_id, d, r_value.ok(), "get_message_id_by_random_id");
if (m != nullptr) {
CHECK(m->random_id == random_id)
LOG_CHECK(m->random_id == random_id)
<< random_id << " " << m->random_id << " " << d->random_id_to_message_id[random_id] << " "
<< d->random_id_to_message_id[m->random_id] << " " << m->message_id << " " << source << " "
<< m->from_database << get_message(d, m->message_id) << " " << m << " "
<< debug_add_message_to_dialog_fail_reason_;
CHECK(d->random_id_to_message_id.count(random_id))
LOG_CHECK(d->random_id_to_message_id.count(random_id))
<< source << " " << random_id << " " << m->message_id << " " << m->is_failed_to_send << " "
<< m->is_outgoing << " " << m->from_database << " " << get_message(d, m->message_id) << " " << m << " "
<< debug_add_message_to_dialog_fail_reason_;
CHECK(d->random_id_to_message_id[random_id] == m->message_id)
LOG_CHECK(d->random_id_to_message_id[random_id] == m->message_id)
<< source << " " << random_id << " " << d->random_id_to_message_id[random_id] << " " << m->message_id
<< " " << m->is_failed_to_send << " " << m->is_outgoing << " " << m->from_database << " "
<< get_message(d, m->message_id) << " " << m << " " << debug_add_message_to_dialog_fail_reason_;
@ -22891,7 +22895,7 @@ void MessagesManager::add_dialog_last_database_message(Dialog *d, unique_ptr<Mes
CHECK(last_database_message->right == nullptr);
auto message_id = last_database_message->message_id;
CHECK(d->last_database_message_id == message_id)
LOG_CHECK(d->last_database_message_id == message_id)
<< message_id << " " << d->last_database_message_id << " " << d->debug_set_dialog_last_database_message_id;
if (!have_input_peer(d->dialog_id, AccessRights::Read)) {
@ -23283,7 +23287,7 @@ MessagesManager::Dialog *MessagesManager::get_dialog_force(DialogId dialog_id) {
if (r_value.is_ok()) {
LOG(INFO) << "Loaded " << dialog_id << " from database";
auto d = on_load_dialog_from_database(dialog_id, r_value.move_as_ok());
CHECK(d == nullptr || d->dialog_id == dialog_id) << d->dialog_id << " " << dialog_id;
LOG_CHECK(d == nullptr || d->dialog_id == dialog_id) << d->dialog_id << " " << dialog_id;
return d;
} else {
LOG(INFO) << "Failed to load " << dialog_id << " from database: " << r_value.error().message();
@ -23302,8 +23306,8 @@ unique_ptr<MessagesManager::Dialog> MessagesManager::parse_dialog(DialogId dialo
if (status.is_error() || !d->dialog_id.is_valid() || d->dialog_id != dialog_id) {
// can't happen unless database is broken, but has been seen in the wild
// if dialog_id is invalid, we can't repair the dialog
CHECK(dialog_id.is_valid()) << "Can't repair " << dialog_id << ' ' << d->dialog_id << ' ' << status << ' '
<< format::as_hex_dump<4>(value.as_slice());
LOG_CHECK(dialog_id.is_valid()) << "Can't repair " << dialog_id << ' ' << d->dialog_id << ' ' << status << ' '
<< format::as_hex_dump<4>(value.as_slice());
LOG(ERROR) << "Repair broken " << dialog_id << ' ' << format::as_hex_dump<4>(value.as_slice());
@ -23549,7 +23553,7 @@ void MessagesManager::process_get_channel_difference_updates(
}
}
}
CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
LOG_CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
if (need_repair_unread_count) {
repair_channel_server_unread_count(get_dialog(dialog_id));
@ -23796,7 +23800,7 @@ void MessagesManager::on_get_channel_difference(
void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool success) {
LOG(INFO) << "After " << (success ? "un" : "") << "successful get channel difference in " << dialog_id;
CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
LOG_CHECK(!running_get_channel_difference(dialog_id)) << '"' << active_get_channel_differencies_[dialog_id] << '"';
auto logevent_it = get_channel_difference_to_logevent_id_.find(dialog_id);
if (logevent_it != get_channel_difference_to_logevent_id_.end()) {

View File

@ -173,7 +173,7 @@ void SecretChatActor::replay_inbound_message(unique_ptr<logevent::InboundSecretM
// check_status(do_inbound_message_decrypted_unchecked(std::move(message)));
do_inbound_message_decrypted_pending(std::move(message));
} else { // just replay
CHECK(message->message_id > last_binlog_message_id_)
LOG_CHECK(message->message_id > last_binlog_message_id_)
<< tag("last_binlog_message_id", last_binlog_message_id_) << tag("message_id", message->message_id);
last_binlog_message_id_ = message->message_id;
check_status(do_inbound_message_decrypted(std::move(message)));
@ -190,7 +190,7 @@ void SecretChatActor::replay_outbound_message(unique_ptr<logevent::OutboundSecre
return;
}
CHECK(!binlog_replay_finish_flag_);
CHECK(message->message_id > last_binlog_message_id_)
LOG_CHECK(message->message_id > last_binlog_message_id_)
<< tag("last_binlog_message_id", last_binlog_message_id_) << tag("message_id", message->message_id);
last_binlog_message_id_ = message->message_id;
do_outbound_message_impl(std::move(message), Promise<>());
@ -310,8 +310,8 @@ void SecretChatActor::send_message_impl(tl_object_ptr<secret_api::DecryptedMessa
if (get_min_layer(*message) > config_state_.his_layer) {
return promise.set_error(Status::Error(400, "Message is not supported by the other side"));
}
CHECK(binlog_replay_finish_flag_) << "Trying to send message before binlog replay is finished: "
<< to_string(*message) << to_string(file);
LOG_CHECK(binlog_replay_finish_flag_) << "Trying to send message before binlog replay is finished: "
<< to_string(*message) << to_string(file);
int64 random_id = 0;
downcast_call(*message, [&](auto &x) { random_id = x.random_id_; });
@ -1055,7 +1055,7 @@ void SecretChatActor::do_outbound_message_impl(unique_ptr<logevent::OutboundSecr
binlog_event->crc = crc64(binlog_event->encrypted_message.as_slice());
LOG(INFO) << "Do outbound message: " << *binlog_event << tag("crc", binlog_event->crc);
auto &state_id_ref = random_id_to_outbound_message_state_token_[binlog_event->random_id];
CHECK(state_id_ref == 0) << "Random id collision";
LOG_CHECK(state_id_ref == 0) << "Random id collision";
state_id_ref = outbound_message_states_.create();
const uint64 state_id = state_id_ref;
auto *state = outbound_message_states_.get(state_id);
@ -2094,7 +2094,7 @@ Status SecretChatActor::on_inbound_action(secret_api::decryptedMessageActionTypi
// Perfect Forward Secrecy
void SecretChatActor::on_outbound_action(secret_api::decryptedMessageActionRequestKey &request_key) {
CHECK(pfs_state_.state == PfsState::WaitSendRequest || pfs_state_.state == PfsState::SendRequest) << pfs_state_;
LOG_CHECK(pfs_state_.state == PfsState::WaitSendRequest || pfs_state_.state == PfsState::SendRequest) << pfs_state_;
pfs_state_.state = PfsState::WaitRequestResponse;
on_pfs_state_changed();
}
@ -2145,7 +2145,7 @@ Status SecretChatActor::on_inbound_action(secret_api::decryptedMessageActionRequ
if (pfs_state_.state != PfsState::Empty) {
return Status::Error("Unexpected RequestKey");
}
CHECK(pfs_state_.other_auth_key.empty()) << "TODO: got requestKey, before old key is dropped";
LOG_CHECK(pfs_state_.other_auth_key.empty()) << "TODO: got requestKey, before old key is dropped";
pfs_state_.state = PfsState::SendAccept;
pfs_state_.handshake = DhHandshake();
pfs_state_.exchange_id = request_key.exchange_id_;

View File

@ -62,7 +62,7 @@ FileId StickersManager::parse_sticker(bool in_sticker_set, T &parser) {
PARSE_FLAG(has_sticker_set_access_hash);
PARSE_FLAG(in_sticker_set_stored);
END_PARSE_FLAGS();
CHECK(in_sticker_set_stored == in_sticker_set)
LOG_CHECK(in_sticker_set_stored == in_sticker_set)
<< in_sticker_set << " " << in_sticker_set_stored << " " << parser.version() << " " << sticker->is_mask << " "
<< has_sticker_set_access_hash << " "
<< format::as_hex_dump<4>(parser.template fetch_string_raw<Slice>(parser.get_left_len()));

View File

@ -216,7 +216,7 @@ void TdDb::do_close(Promise<> on_finished, bool destroy_flag) {
mpas.add_promise(PromiseCreator::lambda(
[promise = std::move(on_finished), sql_connection = std::move(sql_connection_), destroy_flag](Unit) mutable {
if (sql_connection) {
CHECK(sql_connection.unique()) << sql_connection.use_count();
LOG_CHECK(sql_connection.unique()) << sql_connection.use_count();
if (destroy_flag) {
sql_connection->close_and_destroy();
} else {

View File

@ -590,7 +590,7 @@ class CliClient final : public Actor {
from_json(object, as_json_value).ensure();
CHECK(object != nullptr);
auto as_json_str2 = json_encode<std::string>(ToJson(object));
CHECK(as_json_str == as_json_str2) << "\n" << tag("a", as_json_str) << "\n" << tag("b", as_json_str2);
LOG_CHECK(as_json_str == as_json_str2) << "\n" << tag("a", as_json_str) << "\n" << tag("b", as_json_str2);
// LOG(INFO) << "on_result [" << generation << "][id=" << id << "] " << as_json_str;
if (generation != generation_) {

View File

@ -77,7 +77,7 @@ Result<FileLoader::FileInfo> FileDownloader::init() {
if (result_fd.is_ok()) {
bitmask = Bitmask(Bitmask::Decode{}, partial.ready_bitmask_);
if (encryption_key_.is_secret()) {
CHECK(partial.iv_.size() == 32) << partial.iv_.size();
LOG_CHECK(partial.iv_.size() == 32) << partial.iv_.size();
encryption_key_.mutable_iv() = as<UInt256>(partial.iv_.data());
next_part_ = narrow_cast<int32>(bitmask.get_ready_parts(0));
}
@ -342,7 +342,7 @@ Result<size_t> FileDownloader::process_part(Part part, NetQueryPtr net_query) {
ctr_state.decrypt(bytes.as_slice(), bytes.as_slice());
}
if (encryption_key_.is_secret()) {
CHECK(next_part_ == part.id) << tag("expected part.id", next_part_) << "!=" << tag("part.id", part.id);
LOG_CHECK(next_part_ == part.id) << tag("expected part.id", next_part_) << "!=" << tag("part.id", part.id);
CHECK(!next_part_stop_);
next_part_++;
if (part.size % 16 != 0) {

View File

@ -389,7 +389,7 @@ void FileGenerateManager::generate_file(uint64 query_id, FullGenerateFileLocatio
CHECK(query_id != 0);
auto it_flag = query_id_to_query_.insert(std::make_pair(query_id, Query{}));
CHECK(it_flag.second) << "Query id must be unique";
LOG_CHECK(it_flag.second) << "Query id must be unique";
auto parent = actor_shared(this, query_id);
Slice file_id_query = "#file_id#";

View File

@ -455,7 +455,7 @@ class FullRemoteFileLocation {
#define as_input_web_file_location() as_input_web_file_location_impl(__FILE__, __LINE__)
tl_object_ptr<telegram_api::inputWebFileLocation> as_input_web_file_location_impl(const char *file, int line) const {
CHECK(is_web()) << file << ' ' << line;
LOG_CHECK(is_web()) << file << ' ' << line;
return make_tl_object<telegram_api::inputWebFileLocation>(web().url_, web().access_hash_);
}
@ -484,15 +484,15 @@ class FullRemoteFileLocation {
#define as_input_document() as_input_document_impl(__FILE__, __LINE__)
tl_object_ptr<telegram_api::inputDocument> as_input_document_impl(const char *file, int line) const {
CHECK(is_common()) << file << ' ' << line;
CHECK(is_document()) << file << ' ' << line;
LOG_CHECK(is_common()) << file << ' ' << line;
LOG_CHECK(is_document()) << file << ' ' << line;
return make_tl_object<telegram_api::inputDocument>(common().id_, common().access_hash_,
BufferSlice(FileReferenceView(file_reference_).upload()));
}
#define as_input_photo() as_input_photo_impl(__FILE__, __LINE__)
tl_object_ptr<telegram_api::inputPhoto> as_input_photo_impl(const char *file, int line) const {
CHECK(is_photo()) << file << ' ' << line;
LOG_CHECK(is_photo()) << file << ' ' << line;
return make_tl_object<telegram_api::inputPhoto>(photo().id_, photo().access_hash_,
BufferSlice(FileReferenceView(file_reference_).upload()));
}
@ -504,7 +504,7 @@ class FullRemoteFileLocation {
#define as_input_secure_file() as_input_secure_file_impl(__FILE__, __LINE__)
tl_object_ptr<telegram_api::inputSecureFile> as_input_secure_file_impl(const char *file, int line) const {
CHECK(is_secure()) << file << ' ' << line;
LOG_CHECK(is_secure()) << file << ' ' << line;
return make_tl_object<telegram_api::inputSecureFile>(common().id_, common().access_hash_);
}

View File

@ -761,7 +761,7 @@ Status FileManager::check_local_location(FileNodePtr node) {
}
FileManager::FileIdInfo *FileManager::get_file_id_info(FileId file_id) {
CHECK(0 <= file_id.get() && file_id.get() < static_cast<int32>(file_id_info_.size()))
LOG_CHECK(0 <= file_id.get() && file_id.get() < static_cast<int32>(file_id_info_.size()))
<< file_id << " " << file_id_info_.size();
return &file_id_info_[file_id.get()];
}
@ -1344,7 +1344,7 @@ Result<FileId> FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sy
for (auto file_id : other_node->file_ids_) {
auto file_id_info = get_file_id_info(file_id);
CHECK(file_id_info->node_id_ == node_ids[other_node_i])
LOG_CHECK(file_id_info->node_id_ == node_ids[other_node_i])
<< node_ids[node_i] << " " << node_ids[other_node_i] << " " << file_id << " " << file_id_info->node_id_;
file_id_info->node_id_ = node_ids[node_i];
send_updates_flag |= file_id_info->send_updates_flag_;

View File

@ -90,7 +90,7 @@ Status PartsManager::init(int64 size, int64 expected_size, bool is_size_final, s
if (size == 0) {
return init_no_size(part_size, ready_parts);
}
CHECK(size > 0) << tag("size", size);
LOG_CHECK(size > 0) << tag("size", size);
unknown_size_flag_ = false;
size_ = size;
@ -107,8 +107,8 @@ Status PartsManager::init(int64 size, int64 expected_size, bool is_size_final, s
CHECK(part_size_ <= MAX_PART_SIZE);
}
}
CHECK(1 <= size_) << tag("size_", size_);
CHECK(!use_part_count_limit || calc_part_count(expected_size_, part_size_) <= MAX_PART_COUNT)
LOG_CHECK(1 <= size_) << tag("size_", size_);
LOG_CHECK(!use_part_count_limit || calc_part_count(expected_size_, part_size_) <= MAX_PART_COUNT)
<< tag("size_", size_) << tag("expected_size", size_) << tag("is_size_final", is_size_final)
<< tag("part_size_", part_size_) << tag("ready_parts", ready_parts.size());
part_count_ = static_cast<int>(calc_part_count(size_, part_size_));
@ -220,7 +220,7 @@ Status PartsManager::set_known_prefix(size_t size, bool is_ready) {
} else {
part_count_ = static_cast<int>(size / part_size_);
}
CHECK(static_cast<size_t>(part_count_) >= part_status_.size())
LOG_CHECK(static_cast<size_t>(part_count_) >= part_status_.size())
<< size << " " << is_ready << " " << part_count_ << " " << part_size_ << " " << part_status_.size();
part_status_.resize(part_count_);
if (use_part_count_limit_ && calc_part_count(expected_size_, part_size_) > MAX_PART_COUNT) {
@ -323,7 +323,7 @@ void PartsManager::init_common(const std::vector<int> &ready_parts) {
part_status_ = vector<PartStatus>(part_count_);
for (auto i : ready_parts) {
CHECK(0 <= i && i < part_count_) << tag("i", i) << tag("part_count", part_count_);
LOG_CHECK(0 <= i && i < part_count_) << tag("i", i) << tag("part_count", part_count_);
part_status_[i] = PartStatus::Ready;
bitmask_.set(i);
auto part = get_part(i);

View File

@ -212,7 +212,7 @@ class LogEventParser : public WithVersion<WithContext<TlParser, Global *>> {
public:
explicit LogEventParser(Slice data) : WithVersion<WithContext<TlParser, Global *>>(data) {
set_version(fetch_int());
CHECK(version() < static_cast<int32>(Version::Next)) << "Wrong version " << version();
LOG_CHECK(version() < static_cast<int32>(Version::Next)) << "Wrong version " << version();
set_context(G());
}
};

View File

@ -212,7 +212,7 @@ void Proxy::parse(T &parser) {
parse(port_, parser);
parse(secret_, parser);
} else {
CHECK(type_ == Proxy::Type::None) << static_cast<int32>(type_);
LOG_CHECK(type_ == Proxy::Type::None) << static_cast<int32>(type_);
}
}
@ -1230,7 +1230,7 @@ void ConnectionCreator::start_up() {
proxy_last_used_date_[proxy_id] = last_used;
proxy_last_used_saved_date_[proxy_id] = last_used;
} else {
CHECK(!ends_with(info.first, "_max_id")) << info.first;
LOG_CHECK(!ends_with(info.first, "_max_id")) << info.first;
int32 proxy_id = info.first == "proxy" ? 1 : to_integer_safe<int32>(Slice(info.first).substr(5)).move_as_ok();
CHECK(proxies_.count(proxy_id) == 0);
log_event_parse(proxies_[proxy_id], info.second).ensure();

View File

@ -18,7 +18,7 @@ NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, Dc
double total_timeout_limit) {
BufferSlice slice(storer.size());
auto real_size = storer.store(slice.as_slice().ubegin());
CHECK(real_size == slice.size()) << real_size << " " << slice.size() << " "
LOG_CHECK(real_size == slice.size()) << real_size << " " << slice.size() << " "
<< format::as_hex_dump<4>(Slice(slice.as_slice()));
// TODO: magic constant

View File

@ -43,7 +43,7 @@ static void parse(NetStatsData &net_stats, T &parser) {
}
void NetStatsManager::init() {
CHECK(!empty()) << G()->close_flag();
LOG_CHECK(!empty()) << G()->close_flag();
class NetStatsInternalCallback : public NetStats::Callback {
public:
NetStatsInternalCallback(ActorId<NetStatsManager> parent, size_t id) : parent_(std::move(parent)), id_(id) {

View File

@ -20,7 +20,7 @@ PublicRsaKeyShared::PublicRsaKeyShared(DcId dc_id, bool is_test) : dc_id_(dc_id)
}
auto add_pem = [this](CSlice pem) {
auto r_rsa = RSA::from_pem(pem);
CHECK(r_rsa.is_ok()) << r_rsa.error() << " " << pem;
LOG_CHECK(r_rsa.is_ok()) << r_rsa.error() << " " << pem;
if (r_rsa.is_ok()) {
this->add_rsa(r_rsa.move_as_ok());

View File

@ -851,7 +851,7 @@ void Session::connection_send_query(ConnectionInfo *info, NetQueryPtr &&net_quer
<< tag("invoke_after", format::as_hex(invoke_after_id));
net_query->set_message_id(message_id);
net_query->cancel_slot_.clear_event();
CHECK(sent_queries_.find(message_id) == sent_queries_.end()) << message_id;
LOG_CHECK(sent_queries_.find(message_id) == sent_queries_.end()) << message_id;
net_query->debug_unknown = false;
net_query->debug_ack = 0;
if (!net_query->cancel_slot_.empty()) {

View File

@ -115,7 +115,7 @@ inline ActorId<> Actor::actor_id() {
}
template <class SelfT>
ActorId<SelfT> Actor::actor_id(SelfT *self) {
CHECK(static_cast<Actor *>(self) == this)
LOG_CHECK(static_cast<Actor *>(self) == this)
<< self << " " << static_cast<Actor *>(self) << " " << this << " " << empty();
return ActorId<SelfT>(info_.get_weak());
}
@ -125,7 +125,7 @@ inline ActorShared<> Actor::actor_shared() {
}
template <class SelfT>
ActorShared<SelfT> Actor::actor_shared(SelfT *self, uint64 id) {
CHECK(static_cast<Actor *>(self) == this)
LOG_CHECK(static_cast<Actor *>(self) == this)
<< self << " " << static_cast<Actor *>(self) << " " << this << " " << empty();
return ActorShared<SelfT>(actor_id(self), id);
}

View File

@ -169,7 +169,7 @@ inline CSlice ActorInfo::get_name() const {
inline void ActorInfo::start_run() {
VLOG(actor) << "start_run: " << *this;
CHECK(!is_running_) << "Recursive call of actor " << tag("name", get_name());
LOG_CHECK(!is_running_) << "Recursive call of actor " << tag("name", get_name());
is_running_ = true;
}
inline void ActorInfo::finish_run() {

View File

@ -5,7 +5,6 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/actor/impl/Actor-decl.h"
#include "td/actor/impl/ActorId-decl.h"
#include "td/actor/impl/EventFull-decl.h"

View File

@ -160,7 +160,7 @@ EventGuard::~EventGuard() {
swap_context(info);
CHECK(info->is_lite() || save_context_ == info->get_context());
#ifdef TD_DEBUG
CHECK(info->is_lite() || save_log_tag2_ == info->get_name().c_str())
LOG_CHECK(info->is_lite() || save_log_tag2_ == info->get_name().c_str())
<< info->is_lite() << " " << info->empty() << " " << info->is_migrating() << " " << save_log_tag2_ << " "
<< info->get_name() << " " << scheduler_->close_flag_;
#endif
@ -307,8 +307,8 @@ void Scheduler::register_migrated_actor(ActorInfo *actor_info) {
VLOG(actor) << "Register migrated actor: " << tag("name", *actor_info) << tag("ptr", actor_info)
<< tag("actor_count", actor_count_);
actor_count_++;
CHECK(actor_info->is_migrating()) << *actor_info << " " << actor_count_ << " " << sched_id_ << " "
<< actor_info->migrate_dest() << " " << actor_info->is_running() << close_flag_;
LOG_CHECK(actor_info->is_migrating()) << *actor_info << " " << actor_count_ << " " << sched_id_ << " "
<< actor_info->migrate_dest() << " " << actor_info->is_running() << close_flag_;
CHECK(sched_id_ == actor_info->migrate_dest());
// CHECK(!actor_info->is_running());
actor_info->finish_migrate();
@ -358,7 +358,7 @@ void Scheduler::do_stop_actor(Actor *actor) {
}
void Scheduler::do_stop_actor(ActorInfo *actor_info) {
CHECK(!actor_info->is_migrating());
CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_;
LOG_CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_;
ObjectPool<ActorInfo>::OwnerPtr owner_ptr;
if (!actor_info->is_lite()) {
EventGuard guard(this, actor_info);
@ -476,7 +476,7 @@ void Scheduler::run_mailbox() {
//LOG(ERROR) << *actor_info;
//cnt++;
//}
//CHECK(cnt == actor_count_) << cnt << " vs " << actor_count_;
//LOG_CHECK(cnt == actor_count_) << cnt << " vs " << actor_count_;
}
Timestamp Scheduler::run_timeout() {

View File

@ -104,7 +104,7 @@ ActorOwn<ActorT> Scheduler::register_actor_impl(Slice name, ActorT *actor_ptr, A
#if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED
sched_id = 0;
#endif
CHECK(sched_id == sched_id_ || (0 <= sched_id && sched_id < static_cast<int32>(outbound_queues_.size()))) << sched_id;
LOG_CHECK(sched_id == sched_id_ || (0 <= sched_id && sched_id < static_cast<int32>(outbound_queues_.size()))) << sched_id;
auto info = actor_info_pool_->create_empty();
VLOG(actor) << "Create actor: " << tag("name", name) << tag("ptr", *info) << tag("context", context())
<< tag("this", this) << tag("actor_count", actor_count_);
@ -140,7 +140,7 @@ inline void Scheduler::destroy_actor(ActorInfo *actor_info) {
VLOG(actor) << "Destroy actor: " << tag("name", *actor_info) << tag("ptr", actor_info)
<< tag("actor_count", actor_count_);
CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_;
LOG_CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_;
cancel_actor_timeout(actor_info);
actor_info->get_list_node()->remove();
// called by ObjectPool

View File

@ -58,7 +58,7 @@ struct Query {
Query(Query &&) = default;
Query &operator=(Query &&) = default;
~Query() {
CHECK(todo.empty()) << "Query lost";
LOG_CHECK(todo.empty()) << "Query lost";
}
int next_pow() {
CHECK(!todo.empty());

View File

@ -289,7 +289,7 @@ class OpenClose final : public Actor {
ObserverBase *observer = reinterpret_cast<ObserverBase *>(123);
if (cnt_ > 0) {
auto r_file_fd = FileFd::open("server", FileFd::Read | FileFd::Create);
CHECK(r_file_fd.is_ok()) << r_file_fd.error();
LOG_CHECK(r_file_fd.is_ok()) << r_file_fd.error();
auto file_fd = r_file_fd.move_as_ok();
{ PollableFd pollable_fd = file_fd.get_poll_info().extract_pollable_fd(observer); }
file_fd.close();

View File

@ -208,7 +208,7 @@ Status SqliteDb::change_key(CSlice path, const DbKey &new_db_key, const DbKey &o
}
TRY_RESULT(new_db, open_with_key(path, new_db_key));
CHECK(new_db.user_version().ok() == user_version) << new_db.user_version().ok() << " " << user_version;
LOG_CHECK(new_db.user_version().ok() == user_version) << new_db.user_version().ok() << " " << user_version;
return Status::OK();
}
Status SqliteDb::destroy(Slice path) {
@ -221,7 +221,7 @@ Result<SqliteStatement> SqliteDb::get_statement(CSlice statement) {
if (rc != SQLITE_OK) {
return Status::Error(PSLICE() << "Failed to prepare SQLite " << tag("statement", statement) << raw_->last_error());
}
CHECK(stmt != nullptr) << statement;
LOG_CHECK(stmt != nullptr) << statement;
return SqliteStatement(stmt, raw_);
}

View File

@ -547,7 +547,7 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb
fd_.truncate_to_current_position(offset).ensure();
db_key_used_ = false; // force reindex
}
CHECK(IGNORE_ERASE_HACK || fd_size_ == offset) << fd_size << " " << fd_size_ << " " << offset;
LOG_CHECK(IGNORE_ERASE_HACK || fd_size_ == offset) << fd_size << " " << fd_size_ << " " << offset;
binlog_reader_ptr_ = nullptr;
state_ = State::Run;
@ -651,7 +651,7 @@ void Binlog::do_reindex() {
auto finish_time = Clocks::monotonic();
auto finish_size = fd_size_;
auto finish_events = fd_events_;
CHECK(fd_size_ == detail::file_size(path_))
LOG_CHECK(fd_size_ == detail::file_size(path_))
<< fd_size_ << ' ' << detail::file_size(path_) << ' ' << fd_events_ << ' ' << path_;
double ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);

View File

@ -18,7 +18,7 @@ int32 VERBOSITY_NAME(binlog) = VERBOSITY_NAME(DEBUG) + 8;
Status BinlogEvent::init(BufferSlice &&raw_event, bool check_crc) {
TlParser parser(raw_event.as_slice());
size_ = parser.fetch_int();
CHECK(size_ == raw_event.size()) << size_ << " " << raw_event.size() << debug_info_;
LOG_CHECK(size_ == raw_event.size()) << size_ << " " << raw_event.size() << debug_info_;
id_ = parser.fetch_long();
type_ = parser.fetch_int();
flags_ = parser.fetch_int();

View File

@ -23,7 +23,7 @@ class BinlogEventsProcessor {
template <class CallbackT>
void for_each(CallbackT &&callback) {
for (size_t i = 0; i < ids_.size(); i++) {
CHECK(i == 0 || ids_[i - 1] < ids_[i]) << ids_[i - 1] << " " << events_[i - 1].public_to_string() << " "
LOG_CHECK(i == 0 || ids_[i - 1] < ids_[i]) << ids_[i - 1] << " " << events_[i - 1].public_to_string() << " "
<< ids_[i] << " " << events_[i].public_to_string();
if ((ids_[i] & 1) == 0) {
callback(events_[i]);

View File

@ -87,7 +87,7 @@ class UdpReader {
helpers_[i].init_inbound_message(messages_[i]);
}
for (size_t i = cnt; i < messages_.size(); i++) {
CHECK(messages_[i].data.size() == 2048)
LOG_CHECK(messages_[i].data.size() == 2048)
<< " cnt = " << cnt << " i = " << i << " size = " << messages_[i].data.size() << " status = " << status;
}
if (status.is_error() && !UdpSocketFd::is_critical_read_error(status)) {

View File

@ -81,7 +81,7 @@ class KHeap {
void check() const {
for (size_t i = 0; i < array_.size(); i++) {
for (size_t j = i * K + 1; j < i * K + 1 + K && j < array_.size(); j++) {
CHECK(array_[i].key_ <= array_[j].key_) << i << " " << j;
LOG_CHECK(array_[i].key_ <= array_[j].key_) << i << " " << j;
}
}
}

View File

@ -189,7 +189,7 @@ class ObjectPool {
delete to_delete;
storage_count_--;
}
CHECK(storage_count_.load() == 0) << storage_count_.load();
LOG_CHECK(storage_count_.load() == 0) << storage_count_.load();
}
private:

View File

@ -37,7 +37,7 @@ class OrderedEventsProcessor {
}
template <class FromDataT, class FunctionT>
void add(SeqNo seq_no, FromDataT &&data, FunctionT &&function) {
CHECK(seq_no >= begin_) << seq_no << ">=" << begin_; // or ignore?
LOG_CHECK(seq_no >= begin_) << seq_no << ">=" << begin_; // or ignore?
if (seq_no == begin_) { // run now
begin_++;

View File

@ -192,7 +192,7 @@ class SharedObjectPool {
while (free_queue_reader_.read()) {
free_cnt++;
}
CHECK(free_cnt == allocated_.size()) << free_cnt << " " << allocated_.size();
LOG_CHECK(free_cnt == allocated_.size()) << free_cnt << " " << allocated_.size();
}
template <class... ArgsT>

View File

@ -404,19 +404,19 @@ class Result {
return std::move(status_);
}
const T &ok() const {
CHECK(status_.is_ok()) << status_;
LOG_CHECK(status_.is_ok()) << status_;
return value_;
}
T &ok_ref() {
CHECK(status_.is_ok()) << status_;
LOG_CHECK(status_.is_ok()) << status_;
return value_;
}
const T &ok_ref() const {
CHECK(status_.is_ok()) << status_;
LOG_CHECK(status_.is_ok()) << status_;
return value_;
}
T move_as_ok() {
CHECK(status_.is_ok()) << status_;
LOG_CHECK(status_.is_ok()) << status_;
return std::move(value_);
}

View File

@ -48,7 +48,7 @@ class TimedStat {
void update(double &now) {
if (now < next_timestamp_) {
// CHECK(now >= next_timestamp_ * (1 - 1e-14)) << now << " " << next_timestamp_;
// LOG_CHECK(now >= next_timestamp_ * (1 - 1e-14)) << now << " " << next_timestamp_;
now = next_timestamp_;
}
if (duration_ == 0) {

View File

@ -170,7 +170,7 @@ class Variant {
template <class T>
void init_empty(T &&t) {
CHECK(offset_ == npos) << offset_
LOG_CHECK(offset_ == npos) << offset_
#if TD_CLANG || TD_GCC
<< ' ' << __PRETTY_FUNCTION__
#endif

View File

@ -602,7 +602,7 @@ class ChainBufferReader {
}
ChainBufferReader cut_head(size_t offset) TD_WARN_UNUSED_RESULT {
CHECK(offset <= size()) << offset << " " << size();
LOG_CHECK(offset <= size()) << offset << " " << size();
auto it = begin_.clone();
it.advance(offset);
return cut_head(std::move(it));

View File

@ -339,8 +339,8 @@ class NarrowCast {
static_assert(std::is_integral<AT>::value, "expected integral type to cast from");
auto r = R(a);
CHECK(A(r) == a) << static_cast<AT>(a) << " " << static_cast<RT>(r) << " " << file_ << " " << line_;
CHECK((is_same_signedness<RT, AT>::value) || ((static_cast<RT>(r) < RT{}) == (static_cast<AT>(a) < AT{})))
LOG_CHECK(A(r) == a) << static_cast<AT>(a) << " " << static_cast<RT>(r) << " " << file_ << " " << line_;
LOG_CHECK((is_same_signedness<RT, AT>::value) || ((static_cast<RT>(r) < RT{}) == (static_cast<AT>(a) < AT{})))
<< static_cast<AT>(a) << " " << static_cast<RT>(r) << " " << file_ << " " << line_;
return r;

View File

@ -73,7 +73,7 @@ void Iocp::subscribe(const NativeFd &native_fd, Callback *callback) {
auto error = OS_ERROR("CreateIoCompletionPort");
LOG(FATAL) << error;
}
CHECK(iocp_handle == iocp_handle_.fd()) << iocp_handle << " " << iocp_handle_.fd();
LOG_CHECK(iocp_handle == iocp_handle_.fd()) << iocp_handle << " " << iocp_handle_.fd();
}
void Iocp::post(size_t size, Callback *callback, WSAOVERLAPPED *overlapped) {

View File

@ -35,7 +35,7 @@ void Select::subscribe(PollableFd fd, PollFlags flags) {
CHECK(it.fd.native_fd().fd() != native_fd);
}
fds_.push_back(FdInfo{std::move(fd), flags});
CHECK(0 <= native_fd && native_fd < FD_SETSIZE) << native_fd << " " << FD_SETSIZE;
LOG_CHECK(0 <= native_fd && native_fd < FD_SETSIZE) << native_fd << " " << FD_SETSIZE;
FD_SET(native_fd, &all_fd_);
if (native_fd > max_fd_) {
max_fd_ = native_fd;
@ -47,7 +47,7 @@ void Select::unsubscribe(PollableFdRef fd) {
int native_fd = fd_locked.native_fd().fd();
fd_locked.release_as_list_node();
CHECK(0 <= native_fd && native_fd < FD_SETSIZE) << native_fd << " " << FD_SETSIZE;
LOG_CHECK(0 <= native_fd && native_fd < FD_SETSIZE) << native_fd << " " << FD_SETSIZE;
FD_CLR(native_fd, &all_fd_);
FD_CLR(native_fd, &read_fd_);
FD_CLR(native_fd, &write_fd_);

View File

@ -136,12 +136,12 @@ inline vector<string> rand_split(string str) {
template <class T1, class T2>
void assert_eq_impl(const T1 &expected, const T2 &got, const char *file, int line) {
CHECK(expected == got) << tag("expected", expected) << tag("got", got) << " in " << file << " at line " << line;
LOG_CHECK(expected == got) << tag("expected", expected) << tag("got", got) << " in " << file << " at line " << line;
}
template <class T>
void assert_true_impl(const T &got, const char *file, int line) {
CHECK(got) << "Expected true in " << file << " at line " << line;
LOG_CHECK(got) << "Expected true in " << file << " at line " << line;
}
} // namespace td

View File

@ -45,15 +45,15 @@
#define END_PARSE_FLAGS() \
CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) \
LOG_CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) \
<< flags_parse << " " << bit_offset_parse << " " << parser.version(); \
} \
while (false)
#define END_PARSE_FLAGS_GENERIC() \
CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) << flags_parse << " " << bit_offset_parse; \
} \
#define END_PARSE_FLAGS_GENERIC() \
CHECK(bit_offset_parse < 31); \
LOG_CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) << flags_parse << " " << bit_offset_parse; \
} \
while (false)
namespace td {

View File

@ -21,7 +21,7 @@ void TlParser::set_error(const string &error_message) {
} else {
data = empty_data;
CHECK(error_pos != std::numeric_limits<size_t>::max());
CHECK(data_len == 0) << data_len << " " << left_len << " " << data << " " << &empty_data[0] << " " << error_pos
LOG_CHECK(data_len == 0) << data_len << " " << left_len << " " << data << " " << &empty_data[0] << " " << error_pos
<< " " << error;
CHECK(left_len == 0);
}

View File

@ -68,7 +68,7 @@ TEST(OneValue, stress) {
if (set_status) {
CHECK(get_status);
CHECK(from.empty());
CHECK(to == "hello") << to;
LOG_CHECK(to == "hello") << to;
} else {
CHECK(!get_status);
CHECK(from == "hello");
@ -122,7 +122,7 @@ TEST(MpmcQueue, simple) {
}
for (int i = 0; i < 100; i++) {
int x = q.pop(0);
CHECK(x == i) << x << " expected " << i;
LOG_CHECK(x == i) << x << " expected " << i;
}
}
}
@ -189,7 +189,7 @@ TEST(MpmcQueue, multi_thread) {
from[data.from] = data.value;
}
}
CHECK(all.size() == n * qn) << all.size();
LOG_CHECK(all.size() == n * qn) << all.size();
std::sort(all.begin(), all.end(),
[](const auto &a, const auto &b) { return std::tie(a.from, a.value) < std::tie(b.from, b.value); });
for (size_t i = 0; i < n * qn; i++) {
@ -201,6 +201,6 @@ TEST(MpmcQueue, multi_thread) {
for (size_t id = 0; id < n + m + 1; id++) {
q.gc(id);
}
CHECK(q.hazard_pointers_to_delele_size_unsafe() == 0) << q.hazard_pointers_to_delele_size_unsafe();
LOG_CHECK(q.hazard_pointers_to_delele_size_unsafe() == 0) << q.hazard_pointers_to_delele_size_unsafe();
}
#endif //!TD_THREAD_UNSUPPORTED

View File

@ -48,7 +48,7 @@ TEST(MpscLinkQueue, one_thread) {
while (auto node = reader.read()) {
v.push_back(node.value().value());
}
CHECK((v == std::vector<int>{1, 2, 3, 4})) << td::format::as_array(v);
LOG_CHECK((v == std::vector<int>{1, 2, 3, 4})) << td::format::as_array(v);
v.clear();
queue.push(create_node(5));
@ -56,7 +56,7 @@ TEST(MpscLinkQueue, one_thread) {
while (auto node = reader.read()) {
v.push_back(node.value().value());
}
CHECK((v == std::vector<int>{5})) << td::format::as_array(v);
LOG_CHECK((v == std::vector<int>{5})) << td::format::as_array(v);
}
{
@ -70,7 +70,7 @@ TEST(MpscLinkQueue, one_thread) {
while (auto node = reader.read()) {
v.push_back(node.value().value());
}
CHECK((v == std::vector<int>{3, 2, 1, 0})) << td::format::as_array(v);
LOG_CHECK((v == std::vector<int>{3, 2, 1, 0})) << td::format::as_array(v);
}
}

View File

@ -80,13 +80,13 @@ static void test_pq(uint64 first, uint64 second) {
std::string p_str, q_str;
int err = td::pq_factorize(pq_str, &p_str, &q_str);
CHECK(err == 0) << first << " * " << second;
LOG_CHECK(err == 0) << first << " * " << second;
BigNum p_res = BigNum::from_binary(p_str);
BigNum q_res = BigNum::from_binary(q_str);
CHECK(p_str == p.to_binary()) << td::tag("got", p_res.to_decimal()) << td::tag("expected", first);
CHECK(q_str == q.to_binary()) << td::tag("got", q_res.to_decimal()) << td::tag("expected", second);
LOG_CHECK(p_str == p.to_binary()) << td::tag("got", p_res.to_decimal()) << td::tag("expected", first);
LOG_CHECK(q_str == q.to_binary()) << td::tag("got", q_res.to_decimal()) << td::tag("expected", second);
}
#endif

View File

@ -203,7 +203,7 @@ static void downcast_call(TlBufferParser &p, F &&f) {
case messages_sendEncryptedService::ID:
return f(*make_tl_object<messages_sendEncryptedService>(p));
default:
CHECK(0) << id;
LOG_CHECK(0) << id;
UNREACHABLE();
}
}

View File

@ -38,7 +38,7 @@ namespace td {
template <class T>
static void check_td_error(T &result) {
CHECK(result->get_id() != td_api::error::ID) << to_string(result);
LOG_CHECK(result->get_id() != td_api::error::ID) << to_string(result);
}
class TestClient : public Actor {
@ -235,9 +235,9 @@ class DoAuthentication : public Task {
on_authorization_ready();
return;
default:
CHECK(false) << "Unexpected authorization state " << to_string(authorization_state);
LOG_CHECK(false) << "Unexpected authorization state " << to_string(authorization_state);
}
send_query(std::move(function), [](auto res) { CHECK(res->get_id() == td_api::ok::ID) << to_string(res); });
send_query(std::move(function), [](auto res) { LOG_CHECK(res->get_id() == td_api::ok::ID) << to_string(res); });
}
void on_authorization_ready() {
LOG(INFO) << "GOT AUTHORIZED";
@ -345,7 +345,7 @@ class CheckTestA : public Task {
auto messageText = move_tl_object_as<td_api::messageText>(message->content_);
auto text = messageText->text_->text_;
if (text.substr(0, tag_.size()) == tag_) {
CHECK(text > previous_text_) << tag("now", text) << tag("previous", previous_text_);
LOG_CHECK(text > previous_text_) << tag("now", text) << tag("previous", previous_text_);
previous_text_ = text;
cnt_--;
LOG(INFO) << "GOT " << tag("text", text) << tag("left", cnt_);