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_); std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
td_guard_.reset(); td_guard_.reset();
stop_flag_ = true; stop_flag_ = true;
delayer_.hangup(); delayer_.reset();
for (const auto &dc : dcs_) { for (auto &dc : dcs_) {
dc.main_session_.hangup(); dc.main_session_.reset();
dc.upload_session_.hangup(); dc.upload_session_.reset();
dc.download_session_.hangup(); dc.download_session_.reset();
dc.download_small_session_.hangup(); dc.download_small_session_.reset();
} }
public_rsa_key_watchdog_.reset(); public_rsa_key_watchdog_.reset();
dc_auth_manager_.reset(); dc_auth_manager_.reset();

View File

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

View File

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