Skip to content

Commit

Permalink
name && log client ip:port
Browse files Browse the repository at this point in the history
  • Loading branch information
weedge authored and kernelai committed Feb 3, 2023
1 parent 873a6d7 commit fdaddd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void ClientCmd::DoInitial() {
return;
}

if (!strcasecmp(argv_[1].data(), "setname") && argv_.size() == 2) {
if (!strcasecmp(argv_[1].data(), "setname") && argv_.size() != 3) {
res_.SetRes(CmdRes::kErrOther,
"Unknown subcommand or wrong number of arguments for "
"'SETNAME'., try CLIENT SETNAME <name>");
Expand Down Expand Up @@ -593,7 +593,7 @@ void ClientCmd::Do(std::shared_ptr<Partition> partition) {
}

if (!strcasecmp(operation_.data(), "getname") && argv_.size() == 2) {
res_.AppendString(conn->get_name());
res_.AppendString(conn->name());
return;
}

Expand Down Expand Up @@ -2547,7 +2547,8 @@ void HelloCmd::Do(std::shared_ptr<Partition> partition) {
fvs.push_back({"role", "master&&slave"});
break;
default:
LOG(WARNING) << "unknown role" << host_role;
LOG(INFO) << "unknown role" << host_role
<< " client ip:port " << conn->ip_port();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pink/include/pink_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class PinkConn : public std::enable_shared_from_this<PinkConn> {
return is_reply_;
}

std::string get_name() { return name_; }
std::string name() { return name_; }
void set_name(std::string name) { name_ = std::move(name); }

bool IsClose() { return close_; }
Expand Down

0 comments on commit fdaddd2

Please sign in to comment.