Remove unsafe Status::operator==.

This commit is contained in:
levlam 2023-05-17 13:45:26 +03:00
parent 5b09f60629
commit d93c06fceb
2 changed files with 6 additions and 3 deletions

View File

@ -67,7 +67,7 @@ class RequestActor : public Actor {
void raw_event(const Event::Raw &event) final { void raw_event(const Event::Raw &event) final {
if (future_.is_error()) { if (future_.is_error()) {
auto error = future_.move_as_error(); auto error = future_.move_as_error();
if (error == Status::Error<FutureActor<T>::HANGUP_ERROR_CODE>()) { if (error.is_static() && error.code() == FutureActor<T>::HANGUP_ERROR_CODE) {
// dropping query due to closing or lost promise // dropping query due to closing or lost promise
if (G()->close_flag()) { if (G()->close_flag()) {
do_send_error(Global::request_aborted_error()); do_send_error(Global::request_aborted_error());

View File

@ -151,8 +151,11 @@ class Status {
public: public:
Status() = default; Status() = default;
bool operator==(const Status &other) const { bool is_static() const {
return ptr_ == other.ptr_; if (is_ok()) {
return true;
}
return get_info().static_flag;
} }
Status clone() const TD_WARN_UNUSED_RESULT { Status clone() const TD_WARN_UNUSED_RESULT {