Deprecate ActorShared with 0 token.
GitOrigin-RevId: 15dc5e63afa4c0d08f911101eaa78513df6aebc5
This commit is contained in:
parent
b8419b7832
commit
2009d58f6a
@ -1055,7 +1055,7 @@ void ConfigManager::request_config_from_dc_impl(DcId dc_id) {
|
|||||||
config_sent_cnt_++;
|
config_sent_cnt_++;
|
||||||
auto query = G()->net_query_creator().create_unauth(telegram_api::help_getConfig(), dc_id);
|
auto query = G()->net_query_creator().create_unauth(telegram_api::help_getConfig(), dc_id);
|
||||||
query->total_timeout_limit_ = 60 * 60 * 24;
|
query->total_timeout_limit_ = 60 * 60 * 24;
|
||||||
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, 0));
|
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManager::do_set_ignore_sensitive_content_restrictions(bool ignore_sensitive_content_restrictions) {
|
void ConfigManager::do_set_ignore_sensitive_content_restrictions(bool ignore_sensitive_content_restrictions) {
|
||||||
@ -1276,7 +1276,7 @@ void ConfigManager::on_result(NetQueryPtr res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK(token == 0);
|
CHECK(token == 8);
|
||||||
CHECK(config_sent_cnt_ > 0);
|
CHECK(config_sent_cnt_ > 0);
|
||||||
config_sent_cnt_--;
|
config_sent_cnt_--;
|
||||||
auto r_config = fetch_result<telegram_api::help_getConfig>(std::move(res));
|
auto r_config = fetch_result<telegram_api::help_getConfig>(std::move(res));
|
||||||
|
@ -72,7 +72,7 @@ class Slot final : public Actor {
|
|||||||
}
|
}
|
||||||
ActorShared<> get_signal_new() {
|
ActorShared<> get_signal_new() {
|
||||||
register_if_empty();
|
register_if_empty();
|
||||||
return actor_shared();
|
return actor_shared(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -101,7 +101,6 @@ class Actor : public ObserverBase {
|
|||||||
template <class SelfT>
|
template <class SelfT>
|
||||||
ActorId<SelfT> actor_id(SelfT *self);
|
ActorId<SelfT> actor_id(SelfT *self);
|
||||||
|
|
||||||
ActorShared<> actor_shared();
|
|
||||||
template <class SelfT>
|
template <class SelfT>
|
||||||
ActorShared<SelfT> actor_shared(SelfT *self, uint64 id = static_cast<uint64>(-1));
|
ActorShared<SelfT> actor_shared(SelfT *self, uint64 id = static_cast<uint64>(-1));
|
||||||
|
|
||||||
|
@ -125,12 +125,11 @@ ActorId<SelfT> Actor::actor_id(SelfT *self) {
|
|||||||
return ActorId<SelfT>(info_.get_weak());
|
return ActorId<SelfT>(info_.get_weak());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ActorShared<> Actor::actor_shared() {
|
|
||||||
return actor_shared(this);
|
|
||||||
}
|
|
||||||
template <class SelfT>
|
template <class SelfT>
|
||||||
ActorShared<SelfT> Actor::actor_shared(SelfT *self, uint64 id) {
|
ActorShared<SelfT> Actor::actor_shared(SelfT *self, uint64 id) {
|
||||||
CHECK(static_cast<Actor *>(self) == this);
|
CHECK(static_cast<Actor *>(self) == this);
|
||||||
|
// TODO replace with CHECK
|
||||||
|
LOG_IF(ERROR, id == 0) << "ActorShared with token 0 must not be created";
|
||||||
return ActorShared<SelfT>(actor_id(self), id);
|
return ActorShared<SelfT>(actor_id(self), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ class SendToDead : public Actor {
|
|||||||
set_timeout_in(Random::fast_uint32() % 3 * 0.001);
|
set_timeout_in(Random::fast_uint32() % 3 * 0.001);
|
||||||
if (ttl_ != 0) {
|
if (ttl_ != 0) {
|
||||||
child_ = create_actor_on_scheduler<Parent>(
|
child_ = create_actor_on_scheduler<Parent>(
|
||||||
"Child", Random::fast_uint32() % Scheduler::instance()->sched_count(), actor_shared(), ttl_ - 1);
|
"Child", Random::fast_uint32() % Scheduler::instance()->sched_count(), actor_shared(this), ttl_ - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void timeout_expired() override {
|
void timeout_expired() override {
|
||||||
@ -376,7 +376,7 @@ class SendToDead : public Actor {
|
|||||||
|
|
||||||
ActorShared<> create_reference() {
|
ActorShared<> create_reference() {
|
||||||
ref_cnt_++;
|
ref_cnt_++;
|
||||||
return actor_shared();
|
return actor_shared(this);
|
||||||
}
|
}
|
||||||
void hangup_shared() override {
|
void hangup_shared() override {
|
||||||
ref_cnt_--;
|
ref_cnt_--;
|
||||||
|
@ -482,7 +482,7 @@ class LaterMasterActor : public Actor {
|
|||||||
std::vector<ActorOwn<LaterSlave>> children_;
|
std::vector<ActorOwn<LaterSlave>> children_;
|
||||||
void start_up() override {
|
void start_up() override {
|
||||||
for (int i = 0; i < cnt_; i++) {
|
for (int i = 0; i < cnt_; i++) {
|
||||||
children_.push_back(create_actor<LaterSlave>("B", actor_shared()));
|
children_.push_back(create_actor<LaterSlave>("B", actor_shared(this)));
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ class Socks5TestActor : public Actor {
|
|||||||
return promise.set_error(Status::Error(PSTRING() << "Failed to open socket: " << r_socket.error()));
|
return promise.set_error(Status::Error(PSTRING() << "Failed to open socket: " << r_socket.error()));
|
||||||
}
|
}
|
||||||
create_actor<Socks5>("socks5", r_socket.move_as_ok(), mtproto_ip_address, "", "",
|
create_actor<Socks5>("socks5", r_socket.move_as_ok(), mtproto_ip_address, "", "",
|
||||||
make_unique<Callback>(std::move(promise)), actor_shared())
|
make_unique<Callback>(std::move(promise)), actor_shared(this))
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user