Set redis task error when NOAUTH.

This commit is contained in:
Xie Han
2024-08-20 23:24:23 +08:00
committed by xiehan
parent 65de9c4e65
commit 98001bb67a

View File

@@ -213,6 +213,13 @@ bool ComplexRedisTask::need_redirect()
if (reply->str == NULL)
return false;
if (strncasecmp(reply->str, "NOAUTH ", 7) == 0)
{
this->state = WFT_STATE_TASK_ERROR;
this->error = WFT_ERR_REDIS_ACCESS_DENIED;
return false;
}
bool asking = false;
if (strncasecmp(reply->str, "ASK ", 4) == 0)
asking = true;
@@ -316,14 +323,6 @@ protected:
return &wrapper_;
}
virtual int keep_alive_timeout()
{
if (!is_user_request_)
return this->ComplexRedisTask::keep_alive_timeout();
return this->keep_alive_timeo;
}
virtual int first_timeout()
{
return watching_ ? this->watch_timeo : 0;
@@ -385,6 +384,11 @@ ComplexRedisSubscribeTask::SubscribeWrapper::next_in(ProtocolMessage *message)
}
}
}
else if (!task_->watching_)
{
task_->finished_ = true;
return NULL;
}
task_->watching_ = true;
task_->extract_(task_);