HttpConnection: safe migrate between schedulers

GitOrigin-RevId: 2bcc79fc100613a86a8048a2c35e4791903ccb11
This commit is contained in:
Arseny Smirnov 2020-08-10 17:10:16 +03:00
parent 301d0577ba
commit 4d19016970
2 changed files with 11 additions and 0 deletions

View File

@ -190,5 +190,13 @@ void HttpConnectionBase::loop() {
}
}
void HttpConnectionBase::on_start_migrate(int32 sched_id) {
Scheduler::unsubscribe(fd_.get_poll_info().get_pollable_fd_ref());
}
void HttpConnectionBase::on_finish_migrate() {
Scheduler::subscribe(fd_.get_poll_info().extract_pollable_fd(this));
}
} // namespace detail
} // namespace td

View File

@ -66,6 +66,9 @@ class HttpConnectionBase : public Actor {
void timeout_expired() override;
void loop() override;
void on_start_migrate(int32 sched_id) override;
void on_finish_migrate() override;
virtual void on_query(unique_ptr<HttpQuery> query) = 0;
virtual void on_error(Status error) = 0;
};