Merge remote-tracking branch 'td/master'

This commit is contained in:
Andrea Cavalli 2021-10-07 00:51:58 +02:00
commit 4e70729edb
16 changed files with 107 additions and 135 deletions

View File

@ -13841,7 +13841,7 @@ void ContactsManager::send_get_user_full_query(UserId user_id, tl_object_ptr<tel
LOG(INFO) << "Get full " << user_id << " from " << source;
auto send_query =
PromiseCreator::lambda([td = td_, input_user = std::move(input_user)](Result<Promise<Unit>> &&promise) mutable {
if (promise.is_ok()) {
if (promise.is_ok() && !G()->close_flag()) {
td->create_handler<GetFullUserQuery>(promise.move_as_ok())->send(std::move(input_user));
}
});
@ -14125,7 +14125,7 @@ void ContactsManager::reload_chat_full(ChatId chat_id, Promise<Unit> &&promise)
void ContactsManager::send_get_chat_full_query(ChatId chat_id, Promise<Unit> &&promise, const char *source) {
LOG(INFO) << "Get full " << chat_id << " from " << source;
auto send_query = PromiseCreator::lambda([td = td_, chat_id](Result<Promise<Unit>> &&promise) {
if (promise.is_ok()) {
if (promise.is_ok() && !G()->close_flag()) {
td->create_handler<GetFullChatQuery>(promise.move_as_ok())->send(chat_id);
}
});
@ -14471,7 +14471,7 @@ void ContactsManager::send_get_channel_full_query(ChannelFull *channel_full, Cha
LOG(INFO) << "Get full " << channel_id << " from " << source;
auto send_query = PromiseCreator::lambda(
[td = td_, channel_id, input_channel = std::move(input_channel)](Result<Promise<Unit>> &&promise) mutable {
if (promise.is_ok()) {
if (promise.is_ok() && !G()->close_flag()) {
td->create_handler<GetFullChannelQuery>(promise.move_as_ok())->send(channel_id, std::move(input_channel));
}
});

View File

@ -128,7 +128,7 @@ void CountryInfoManager::tear_down() {
std::lock_guard<std::mutex> country_lock(country_mutex_);
manager_count_--;
if (manager_count_ == 0) {
if (manager_count_ == 0 && !countries_.empty()) {
LOG(INFO) << "Clear country info";
countries_.clear();
}

View File

@ -99,7 +99,7 @@ FileSourceId FileReferenceManager::create_recent_stickers_file_source(bool is_at
FileSourceId FileReferenceManager::create_favorite_stickers_file_source() {
FileSourceFavoriteStickers source;
return add_file_source_id(source, PSLICE() << "favorite stickers");
return add_file_source_id(source, "favorite stickers");
}
FileSourceId FileReferenceManager::create_background_file_source(BackgroundId background_id, int64 access_hash) {

View File

@ -109,6 +109,7 @@ class Global final : public ActorContext {
}
void set_net_query_stats(std::shared_ptr<NetQueryStats> net_query_stats);
void set_net_query_dispatcher(unique_ptr<NetQueryDispatcher> net_query_dispatcher);
NetQueryDispatcher &net_query_dispatcher() {

View File

@ -952,8 +952,8 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_t_me_link_query(Slice q
} else if (path[0][0] == ' ' || path[0][0] == '+') {
if (path[0].size() >= 2) {
// /+<link>
return td::make_unique<InternalLinkDialogInvite>(
PSTRING() << "tg:join?invite=" + url_encode(get_url_query_hash(false, url_query)));
return td::make_unique<InternalLinkDialogInvite>(PSTRING() << "tg:join?invite="
<< url_encode(get_url_query_hash(false, url_query)));
}
} else if (path[0] == "addstickers") {
if (path.size() >= 2 && !path[1].empty()) {

View File

@ -230,15 +230,19 @@ class MessagesDbImpl final : public MessagesDbSyncInterface {
"ORDER BY rowid DESC LIMIT ?3) ORDER BY search_id DESC"));
for (int32 i = 0; i < MESSAGES_DB_INDEX_COUNT; i++) {
TRY_RESULT_ASSIGN(get_messages_from_index_stmts_[i].desc_stmt_,
db_.get_statement(PSLICE() << "SELECT data, message_id FROM messages WHERE dialog_id = ?1 "
"AND message_id < ?2 AND (index_mask & "
<< (1 << i) << ") != 0 ORDER BY message_id DESC LIMIT ?3"));
TRY_RESULT_ASSIGN(
get_messages_from_index_stmts_[i].desc_stmt_,
db_.get_statement(
PSLICE()
<< "SELECT data, message_id FROM messages WHERE dialog_id = ?1 AND message_id < ?2 AND (index_mask & "
<< (1 << i) << ") != 0 ORDER BY message_id DESC LIMIT ?3"));
TRY_RESULT_ASSIGN(get_messages_from_index_stmts_[i].asc_stmt_,
db_.get_statement(PSLICE() << "SELECT data, message_id FROM messages WHERE dialog_id = ?1 "
"AND message_id > ?2 AND (index_mask & "
<< (1 << i) << ") != 0 ORDER BY message_id ASC LIMIT ?3"));
TRY_RESULT_ASSIGN(
get_messages_from_index_stmts_[i].asc_stmt_,
db_.get_statement(
PSLICE()
<< "SELECT data, message_id FROM messages WHERE dialog_id = ?1 AND message_id > ?2 AND (index_mask & "
<< (1 << i) << ") != 0 ORDER BY message_id ASC LIMIT ?3"));
// LOG(ERROR) << get_messages_from_index_stmts_[i].desc_stmt_.explain().ok();
// LOG(ERROR) << get_messages_from_index_stmts_[i].asc_stmt_.explain().ok();

View File

@ -277,12 +277,12 @@ class GetDialogQuery final : public Td::ResultHandler {
td->messages_manager_->on_get_dialogs(
FolderId(), std::move(result->dialogs_), -1, std::move(result->messages_),
PromiseCreator::lambda([td = td, dialog_id = dialog_id_](Result<> result) {
if (G()->close_flag()) {
return;
}
if (result.is_ok()) {
td->messages_manager_->on_get_dialog_query_finished(dialog_id, Status::OK());
} else {
if (G()->close_flag()) {
return;
}
td->messages_manager_->on_get_dialog_error(dialog_id, result.error(), "OnGetDialogs");
td->messages_manager_->on_get_dialog_query_finished(dialog_id, result.move_as_error());
}
@ -511,6 +511,9 @@ class GetChannelMessagesQuery final : public Td::ResultHandler {
DialogId(channel_id_), std::move(info),
PromiseCreator::lambda(
[td = td, promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
@ -1977,6 +1980,9 @@ class GetDialogMessageByDateQuery final : public Td::ResultHandler {
dialog_id_, std::move(info),
PromiseCreator::lambda([td = td, dialog_id = dialog_id_, date = date_, random_id = random_id_,
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
@ -2056,6 +2062,9 @@ class GetHistoryQuery final : public Td::ResultHandler {
old_last_new_message_id = old_last_new_message_id_, offset = offset_, limit = limit_,
from_the_end = from_the_end_,
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
@ -2271,6 +2280,9 @@ class SearchMessagesQuery final : public Td::ResultHandler {
offset = offset_, limit = limit_, filter = filter_,
top_thread_message_id = top_thread_message_id_, random_id = random_id_,
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
@ -2460,16 +2472,16 @@ class GetAllScheduledMessagesQuery final : public Td::ResultHandler {
};
class GetRecentLocationsQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
Promise<td_api::object_ptr<td_api::messages>> promise_;
DialogId dialog_id_;
int32 limit_;
int64 random_id_;
public:
explicit GetRecentLocationsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
explicit GetRecentLocationsQuery(Promise<td_api::object_ptr<td_api::messages>> &&promise)
: promise_(std::move(promise)) {
}
void send(DialogId dialog_id, int32 limit, int64 random_id) {
void send(DialogId dialog_id, int32 limit) {
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
if (input_peer == nullptr) {
return on_error(0, Status::Error(400, "Have no info about the chat"));
@ -2477,7 +2489,6 @@ class GetRecentLocationsQuery final : public Td::ResultHandler {
dialog_id_ = dialog_id;
limit_ = limit;
random_id_ = random_id;
send_query(
G()->net_query_creator().create(telegram_api::messages_getRecentLocations(std::move(input_peer), limit, 0)));
@ -2492,22 +2503,23 @@ class GetRecentLocationsQuery final : public Td::ResultHandler {
auto info = td->messages_manager_->on_get_messages(result_ptr.move_as_ok(), "GetRecentLocationsQuery");
td->messages_manager_->get_channel_difference_if_needed(
dialog_id_, std::move(info),
PromiseCreator::lambda([td = td, dialog_id = dialog_id_, limit = limit_, random_id = random_id_,
PromiseCreator::lambda([td = td, dialog_id = dialog_id_, limit = limit_,
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
auto info = result.move_as_ok();
td->messages_manager_->on_get_recent_locations(dialog_id, limit, random_id, info.total_count,
std::move(info.messages));
promise.set_value(Unit());
td->messages_manager_->on_get_recent_locations(dialog_id, limit, info.total_count, std::move(info.messages),
std::move(promise));
}
}));
}
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetRecentLocationsQuery");
td->messages_manager_->on_get_recent_locations_failed(random_id_);
promise_.set_error(std::move(status));
}
};
@ -2548,6 +2560,9 @@ class GetMessagePublicForwardsQuery final : public Td::ResultHandler {
td->messages_manager_->get_channel_differences_if_needed(
std::move(info), PromiseCreator::lambda([td = td, promise = std::move(promise_)](
Result<MessagesManager::MessagesInfo> &&result) mutable {
if (G()->close_flag()) {
result = Status::Error(500, "Request aborted");
}
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
@ -9187,6 +9202,9 @@ void MessagesManager::after_get_difference() {
if (message_id <= d->last_new_message_id) {
get_message_from_server(
it.first, PromiseCreator::lambda([this, full_message_id](Result<Unit> result) {
if (G()->close_flag()) {
return;
}
if (result.is_error()) {
LOG(WARNING) << "Failed to get missing " << full_message_id << ": " << result.error();
} else {
@ -9293,14 +9311,10 @@ void MessagesManager::get_channel_difference_if_needed(DialogId dialog_id, Messa
Promise<MessagesInfo> &&promise) {
for (auto &message : messages_info.messages) {
if (need_channel_difference_to_add_message(dialog_id, message)) {
return run_after_channel_difference(dialog_id,
PromiseCreator::lambda([messages_info = std::move(messages_info),
promise = std::move(promise)](Unit ignored) mutable {
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
promise.set_value(std::move(messages_info));
}));
return run_after_channel_difference(
dialog_id,
PromiseCreator::lambda([messages_info = std::move(messages_info), promise = std::move(promise)](
Unit ignored) mutable { promise.set_value(std::move(messages_info)); }));
}
}
promise.set_value(std::move(messages_info));
@ -9998,14 +10012,11 @@ void MessagesManager::on_get_scheduled_server_messages(DialogId dialog_id, uint3
send_update_chat_has_scheduled_messages(d, false);
}
void MessagesManager::on_get_recent_locations(DialogId dialog_id, int32 limit, int64 random_id, int32 total_count,
vector<tl_object_ptr<telegram_api::Message>> &&messages) {
void MessagesManager::on_get_recent_locations(DialogId dialog_id, int32 limit, int32 total_count,
vector<tl_object_ptr<telegram_api::Message>> &&messages,
Promise<td_api::object_ptr<td_api::messages>> &&promise) {
LOG(INFO) << "Receive " << messages.size() << " recent locations in " << dialog_id;
auto it = found_dialog_recent_location_messages_.find(random_id);
CHECK(it != found_dialog_recent_location_messages_.end());
auto &result = it->second.second;
CHECK(result.empty());
vector<MessageId> result;
for (auto &message : messages) {
auto new_full_message_id = on_get_message(std::move(message), false, dialog_id.get_type() == DialogType::Channel,
false, false, false, "get recent locations");
@ -10034,13 +10045,7 @@ void MessagesManager::on_get_recent_locations(DialogId dialog_id, int32 limit, i
<< " messages";
total_count = static_cast<int32>(result.size());
}
it->second.first = total_count;
}
void MessagesManager::on_get_recent_locations_failed(int64 random_id) {
auto it = found_dialog_recent_location_messages_.find(random_id);
CHECK(it != found_dialog_recent_location_messages_.end());
found_dialog_recent_location_messages_.erase(it);
promise.set_value(get_messages_object(total_count, dialog_id, result, true, "on_get_recent_locations"));
}
void MessagesManager::on_get_message_public_forwards(int32 total_count,
@ -21486,25 +21491,12 @@ std::pair<int32, vector<FullMessageId>> MessagesManager::search_call_messages(Me
return result;
}
std::pair<int32, vector<MessageId>> MessagesManager::search_dialog_recent_location_messages(DialogId dialog_id,
int32 limit,
int64 &random_id,
Promise<Unit> &&promise) {
if (random_id != 0) {
// request has already been sent before
auto it = found_dialog_recent_location_messages_.find(random_id);
CHECK(it != found_dialog_recent_location_messages_.end());
auto result = std::move(it->second);
found_dialog_recent_location_messages_.erase(it);
promise.set_value(Unit());
return result;
}
void MessagesManager::search_dialog_recent_location_messages(DialogId dialog_id, int32 limit,
Promise<td_api::object_ptr<td_api::messages>> &&promise) {
LOG(INFO) << "Search recent location messages in " << dialog_id << " with limit " << limit;
std::pair<int32, vector<MessageId>> result;
if (limit <= 0) {
promise.set_error(Status::Error(400, "Parameter limit must be positive"));
return result;
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
}
if (limit > MAX_SEARCH_MESSAGES) {
limit = MAX_SEARCH_MESSAGES;
@ -21512,30 +21504,20 @@ std::pair<int32, vector<MessageId>> MessagesManager::search_dialog_recent_locati
const Dialog *d = get_dialog_force(dialog_id, "search_dialog_recent_location_messages");
if (d == nullptr) {
promise.set_error(Status::Error(400, "Chat not found"));
return result;
return promise.set_error(Status::Error(400, "Chat not found"));
}
do {
random_id = Random::secure_int64();
} while (random_id == 0 ||
found_dialog_recent_location_messages_.find(random_id) != found_dialog_recent_location_messages_.end());
found_dialog_recent_location_messages_[random_id]; // reserve place for result
switch (dialog_id.get_type()) {
case DialogType::User:
case DialogType::Chat:
case DialogType::Channel:
td_->create_handler<GetRecentLocationsQuery>(std::move(promise))->send(dialog_id, limit, random_id);
break;
return td_->create_handler<GetRecentLocationsQuery>(std::move(promise))->send(dialog_id, limit);
case DialogType::SecretChat:
promise.set_value(Unit());
break;
return promise.set_value(get_messages_object(0, vector<td_api::object_ptr<td_api::message>>(), true));
default:
UNREACHABLE();
promise.set_error(Status::Error(500, "Search messages is not supported"));
}
return result;
}
vector<FullMessageId> MessagesManager::get_active_live_location_messages(Promise<Unit> &&promise) {
@ -23643,7 +23625,8 @@ bool MessagesManager::is_message_auto_read(DialogId dialog_id, bool is_outgoing)
if (user_id == td_->contacts_manager_->get_my_id()) {
return true;
}
if (is_outgoing && td_->contacts_manager_->is_user_bot(user_id)) {
if (is_outgoing && td_->contacts_manager_->is_user_bot(user_id) &&
!td_->contacts_manager_->is_user_support(user_id)) {
return true;
}
return false;
@ -27854,12 +27837,16 @@ void MessagesManager::get_message_notifications_from_database(DialogId dialog_id
<< dialog_id << " from " << from_notification_id << "/" << from_message_id;
bool from_mentions = d->mention_notification_group.group_id == group_id;
if (d->new_secret_chat_notification_id.is_valid()) {
CHECK(d->dialog_id.get_type() == DialogType::SecretChat);
CHECK(dialog_id.get_type() == DialogType::SecretChat);
vector<Notification> notifications;
if (!from_mentions && d->new_secret_chat_notification_id.get() < from_notification_id.get()) {
notifications.emplace_back(d->new_secret_chat_notification_id,
td_->contacts_manager_->get_secret_chat_date(d->dialog_id.get_secret_chat_id()), false,
create_new_secret_chat_notification());
auto date = td_->contacts_manager_->get_secret_chat_date(dialog_id.get_secret_chat_id());
if (date <= 0) {
remove_new_secret_chat_notification(d, true);
} else {
notifications.emplace_back(d->new_secret_chat_notification_id, date, false,
create_new_secret_chat_notification());
}
}
return promise.set_value(std::move(notifications));
}
@ -28002,6 +27989,7 @@ void MessagesManager::on_get_message_notifications_from_database(DialogId dialog
if (is_correct) {
// skip mention messages returned among unread messages
CHECK(m->date > 0);
res.emplace_back(m->notification_id, m->date, m->disable_notification,
create_new_message_notification(m->message_id));
} else {

View File

@ -226,9 +226,9 @@ class MessagesManager final : public Actor {
void on_get_scheduled_server_messages(DialogId dialog_id, uint32 generation,
vector<tl_object_ptr<telegram_api::Message>> &&messages, bool is_not_modified);
void on_get_recent_locations(DialogId dialog_id, int32 limit, int64 random_id, int32 total_count,
vector<tl_object_ptr<telegram_api::Message>> &&messages);
void on_get_recent_locations_failed(int64 random_id);
void on_get_recent_locations(DialogId dialog_id, int32 limit, int32 total_count,
vector<tl_object_ptr<telegram_api::Message>> &&messages,
Promise<td_api::object_ptr<td_api::messages>> &&promise);
void on_get_message_public_forwards(int32 total_count, vector<tl_object_ptr<telegram_api::Message>> &&messages,
Promise<td_api::object_ptr<td_api::foundMessages>> &&promise);
@ -720,8 +720,8 @@ class MessagesManager final : public Actor {
std::pair<int32, vector<FullMessageId>> search_call_messages(MessageId from_message_id, int32 limit, bool only_missed,
int64 &random_id, bool use_db, Promise<Unit> &&promise);
std::pair<int32, vector<MessageId>> search_dialog_recent_location_messages(DialogId dialog_id, int32 limit,
int64 &random_id, Promise<Unit> &&promise);
void search_dialog_recent_location_messages(DialogId dialog_id, int32 limit,
Promise<td_api::object_ptr<td_api::messages>> &&promise);
vector<FullMessageId> get_active_live_location_messages(Promise<Unit> &&promise);
@ -3285,8 +3285,6 @@ class MessagesManager final : public Actor {
found_messages_; // random_id -> [total_count, [full_message_id]...]
std::unordered_map<int64, std::pair<int32, vector<FullMessageId>>>
found_call_messages_; // random_id -> [total_count, [full_message_id]...]
std::unordered_map<int64, std::pair<int32, vector<MessageId>>>
found_dialog_recent_location_messages_; // random_id -> [total_count, [message_id]...]
std::unordered_map<int64, FoundMessages> found_fts_messages_; // random_id -> FoundMessages

View File

@ -858,7 +858,7 @@ Status SecretChatActor::do_inbound_message_encrypted(unique_ptr<log_event::Inbou
send_update_secret_chat();
}
if (layer >= static_cast<int32>(SecretChatLayer::Mtproto2) && mtproto_version < 2) {
return Status::Error(PSLICE() << "MTProto 1.0 encryption is forbidden for this layer");
return Status::Error("MTProto 1.0 encryption is forbidden for this layer");
}
if (message_with_layer->in_seq_no_ < 0) {
return Status::Error(PSLICE() << "Invalid seq_no: " << to_string(message_with_layer));

View File

@ -1517,29 +1517,6 @@ class SearchCallMessagesRequest final : public RequestActor<> {
}
};
class SearchChatRecentLocationMessagesRequest final : public RequestActor<> {
DialogId dialog_id_;
int32 limit_;
int64 random_id_;
std::pair<int32, vector<MessageId>> messages_;
void do_run(Promise<Unit> &&promise) final {
messages_ = td->messages_manager_->search_dialog_recent_location_messages(dialog_id_, limit_, random_id_,
std::move(promise));
}
void do_send_result() final {
send_result(td->messages_manager_->get_messages_object(messages_.first, dialog_id_, messages_.second, true,
"SearchChatRecentLocationMessagesRequest"));
}
public:
SearchChatRecentLocationMessagesRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int32 limit)
: RequestActor(std::move(td), request_id), dialog_id_(dialog_id), limit_(limit), random_id_(0) {
}
};
class GetActiveLiveLocationMessagesRequest final : public RequestActor<> {
vector<FullMessageId> full_message_ids_;
@ -5435,7 +5412,9 @@ void Td::on_request(uint64 id, const td_api::deleteAllCallMessages &request) {
void Td::on_request(uint64 id, const td_api::searchChatRecentLocationMessages &request) {
CHECK_IS_USER();
CREATE_REQUEST(SearchChatRecentLocationMessagesRequest, request.chat_id_, request.limit_);
CREATE_REQUEST_PROMISE();
messages_manager_->search_dialog_recent_location_messages(DialogId(request.chat_id_), request.limit_,
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getActiveLiveLocationMessages &request) {

View File

@ -20,6 +20,11 @@
namespace td {
NetQueryCreator::NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats)
: net_query_stats_(std::move(net_query_stats)) {
object_pool_.set_check_empty(true);
}
NetQueryPtr NetQueryCreator::create(const telegram_api::Function &function, DcId dc_id, NetQuery::Type type) {
return create(UniqueId::next(), function, dc_id, type, NetQuery::AuthFlag::On);
}

View File

@ -23,10 +23,7 @@ class Function;
class NetQueryCreator {
public:
explicit NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats = {}) {
net_query_stats_ = std::move(net_query_stats);
object_pool_.set_check_empty(true);
}
explicit NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats);
void stop_check() {
object_pool_.set_check_empty(false);

View File

@ -196,7 +196,7 @@ class Scheduler {
Timestamp run_timeout();
void run_mailbox();
Timestamp run_events();
Timestamp run_events(Timestamp timeout);
void run_poll(Timestamp timeout);
template <class ActorT>

View File

@ -487,18 +487,29 @@ Timestamp Scheduler::run_timeout() {
return get_timeout();
}
Timestamp Scheduler::run_events(Timestamp timeout) {
Timestamp res;
VLOG(actor) << "Run events " << sched_id_ << " " << tag("pending", pending_events_.size())
<< tag("actors", actor_count_);
do {
run_mailbox();
res = run_timeout();
} while (!ready_actors_list_.empty() && !timeout.is_in_past());
return res;
}
void Scheduler::run_no_guard(Timestamp timeout) {
CHECK(has_guard_);
SCOPE_EXIT {
yield_flag_ = false;
};
timeout.relax(run_events());
timeout.relax(run_events(timeout));
if (yield_flag_) {
return;
}
run_poll(timeout);
run_events();
run_events(timeout);
}
Timestamp Scheduler::get_timeout() {

View File

@ -345,17 +345,6 @@ inline void Scheduler::wakeup() {
#endif
}
inline Timestamp Scheduler::run_events() {
Timestamp res;
VLOG(actor) << "Run events " << sched_id_ << " " << tag("pending", pending_events_.size())
<< tag("actors", actor_count_);
do {
run_mailbox();
res = run_timeout();
} while (!ready_actors_list_.empty());
return res;
}
inline void Scheduler::run(Timestamp timeout) {
auto guard = get_guard();
run_no_guard(timeout);

View File

@ -562,7 +562,7 @@ class FakeSecretChatContext final : public SecretChatActor::Context {
std::shared_ptr<SecretChatDb> secret_chat_db_;
};
NetQueryCreator FakeSecretChatContext::net_query_creator_;
NetQueryCreator FakeSecretChatContext::net_query_creator_{nullptr};
class Master final : public Actor {
public: