-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: impl hello and set name command with resp2 compatible #1245
Conversation
src/pink/include/pink_conn.h
Outdated
@@ -80,6 +80,9 @@ class PinkConn : public std::enable_shared_from_this<PinkConn> { | |||
return is_reply_; | |||
} | |||
|
|||
std::string get_name() { return name_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数名为name() ,会更好一点。
src/pika_admin.cc
Outdated
return; | ||
} | ||
|
||
if (!strcasecmp(argv_[1].data(), "setname") && argv_.size() == 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要考虑下 处理setname foo bar dummy
这种情况么
res_.SetRes(CmdRes::kErrOther, "-NOPROTO unsupported protocol version"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next_arg++;
放在这里会更好一点,表示我们在这里处理完了一个参数。
} | ||
|
||
for (; next_arg < argv_.size(); ++next_arg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接next_arg= 2
更好一点?作为读者,我们不必关心next_arg前面的处理逻辑。
src/pika_admin.cc
Outdated
break; | ||
default: | ||
LOG(WARNING) << "unknown role" << host_role; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更多的信息能帮助定位哪个客户端发送的信息有误,例如connection 的ip 地址。
日志级别我任务info级别足够了,因为不是pika server 本身的错误。用户设置高的日志级别就是为了过滤掉信息
INVALID_CONN, | ||
}; | ||
|
||
static AuthResult AuthenticateUser(const std::string& pwd, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑下如何跟auth cmd 复用,逻辑是相似的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑到auth cmd是已有稳定代码
This patch tries to fix those issue:
tips: this patch don't support RESP3 switch, maybe next feature to do :)