Inline ActorOwn::hangup.

This commit is contained in:
levlam 2022-10-01 15:58:27 +03:00
parent 39d2ac80b0
commit be87e4179f
3 changed files with 7 additions and 13 deletions

View File

@ -209,12 +209,12 @@ void NetQueryDispatcher::stop() {
std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
td_guard_.reset();
stop_flag_ = true;
delayer_.hangup();
for (const auto &dc : dcs_) {
dc.main_session_.hangup();
dc.upload_session_.hangup();
dc.download_session_.hangup();
dc.download_small_session_.hangup();
delayer_.reset();
for (auto &dc : dcs_) {
dc.main_session_.reset();
dc.upload_session_.reset();
dc.download_session_.reset();
dc.download_small_session_.reset();
}
public_rsa_key_watchdog_.reset();
dc_auth_manager_.reset();

View File

@ -90,7 +90,6 @@ class ActorOwn {
ActorId<ActorType> get() const;
ActorId<ActorType> release();
void reset(ActorId<ActorType> other = ActorId<ActorType>());
void hangup() const;
ActorType *get_actor_unsafe() const;
private:

View File

@ -88,15 +88,10 @@ ActorId<ActorType> ActorOwn<ActorType>::release() {
template <class ActorType>
void ActorOwn<ActorType>::reset(ActorId<ActorType> other) {
static_assert(sizeof(ActorType) > 0, "Can't use ActorOwn with incomplete type");
hangup();
id_ = std::move(other);
}
template <class ActorType>
void ActorOwn<ActorType>::hangup() const {
if (!id_.empty()) {
send_event(id_, Event::hangup());
}
id_ = std::move(other);
}
template <class ActorType>