Add add_channel source debug.
GitOrigin-RevId: 9785f3f33bf7cd55650b9874e6167620e2a6ce85
This commit is contained in:
parent
db46614353
commit
ecc774367b
@ -5647,8 +5647,8 @@ void ContactsManager::on_binlog_channel_event(BinlogEvent &&event) {
|
|||||||
|
|
||||||
auto channel_id = log_event.channel_id;
|
auto channel_id = log_event.channel_id;
|
||||||
LOG(INFO) << "Add " << channel_id << " from binlog";
|
LOG(INFO) << "Add " << channel_id << " from binlog";
|
||||||
Channel *c = add_channel(channel_id);
|
Channel *c = add_channel(channel_id, "on_binlog_channel_event");
|
||||||
CHECK(c->status.is_banned());
|
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 = std::move(log_event.c); // channels come from binlog before all other events, so just add them
|
||||||
|
|
||||||
c->logevent_id = event.id_;
|
c->logevent_id = event.id_;
|
||||||
@ -5759,7 +5759,7 @@ void ContactsManager::on_load_channel_from_database(ChannelId channel_id, string
|
|||||||
Channel *c = get_channel(channel_id);
|
Channel *c = get_channel(channel_id);
|
||||||
if (c == nullptr) {
|
if (c == nullptr) {
|
||||||
if (!value.empty()) {
|
if (!value.empty()) {
|
||||||
c = add_channel(channel_id);
|
c = add_channel(channel_id, "on_load_channel_from_database");
|
||||||
|
|
||||||
log_event_parse(*c, value).ensure();
|
log_event_parse(*c, value).ensure();
|
||||||
|
|
||||||
@ -8552,9 +8552,13 @@ ContactsManager::Channel *ContactsManager::get_channel(ChannelId channel_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactsManager::Channel *ContactsManager::add_channel(ChannelId channel_id) {
|
ContactsManager::Channel *ContactsManager::add_channel(ChannelId channel_id, const char *source) {
|
||||||
CHECK(channel_id.is_valid());
|
CHECK(channel_id.is_valid());
|
||||||
return &channels_[channel_id];
|
Channel *c = &channels_[channel_id];
|
||||||
|
if (c->debug_source == nullptr) {
|
||||||
|
c->debug_source = source;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContactsManager::get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise) {
|
bool ContactsManager::get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise) {
|
||||||
@ -9123,7 +9127,7 @@ void ContactsManager::on_chat_update(telegram_api::chat &chat) {
|
|||||||
LOG(ERROR) << "Receive invalid " << migrated_to_channel_id << " in " << debug_str;
|
LOG(ERROR) << "Receive invalid " << migrated_to_channel_id << " in " << debug_str;
|
||||||
} else {
|
} else {
|
||||||
// temporarily create the channel
|
// temporarily create the channel
|
||||||
Channel *c = add_channel(migrated_to_channel_id);
|
Channel *c = add_channel(migrated_to_channel_id, "on_chat_update");
|
||||||
c->access_hash = input_channel->access_hash_;
|
c->access_hash = input_channel->access_hash_;
|
||||||
c->title = chat.title_;
|
c->title = chat.title_;
|
||||||
c->status = DialogParticipantStatus::Left();
|
c->status = DialogParticipantStatus::Left();
|
||||||
@ -9284,7 +9288,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel *c = add_channel(channel_id);
|
Channel *c = add_channel(channel_id, "on_channel");
|
||||||
if (c->status.is_banned()) { // possibly uninited channel
|
if (c->status.is_banned()) { // possibly uninited channel
|
||||||
min_channels_.erase(channel_id);
|
min_channels_.erase(channel_id);
|
||||||
}
|
}
|
||||||
@ -9338,7 +9342,7 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel *c = add_channel(channel_id);
|
Channel *c = add_channel(channel_id, "on_channel_forbidden");
|
||||||
if (c->status.is_banned()) { // possibly uninited channel
|
if (c->status.is_banned()) { // possibly uninited channel
|
||||||
min_channels_.erase(channel_id);
|
min_channels_.erase(channel_id);
|
||||||
}
|
}
|
||||||
|
@ -600,6 +600,8 @@ class ContactsManager : public Actor {
|
|||||||
bool is_being_saved = false; // is current channel being saved to the database
|
bool is_being_saved = false; // is current channel being saved to the database
|
||||||
uint64 logevent_id = 0;
|
uint64 logevent_id = 0;
|
||||||
|
|
||||||
|
const char *debug_source = nullptr;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const;
|
void store(StorerT &storer) const;
|
||||||
|
|
||||||
@ -791,7 +793,7 @@ class ContactsManager : public Actor {
|
|||||||
Channel *get_channel(ChannelId channel_id);
|
Channel *get_channel(ChannelId channel_id);
|
||||||
Channel *get_channel_force(ChannelId channel_id);
|
Channel *get_channel_force(ChannelId channel_id);
|
||||||
|
|
||||||
Channel *add_channel(ChannelId channel_id);
|
Channel *add_channel(ChannelId channel_id, const char *source);
|
||||||
|
|
||||||
const ChannelFull *get_channel_full(ChannelId channel_id) const;
|
const ChannelFull *get_channel_full(ChannelId channel_id) const;
|
||||||
ChannelFull *get_channel_full(ChannelId channel_id);
|
ChannelFull *get_channel_full(ChannelId channel_id);
|
||||||
|
Reference in New Issue
Block a user