message: fix ping in pubsub
diff: @@ -34,6 +34,24 @@ static std::string ConstructPubSubResp(
  return resp.str();
  }
  +static std::string ConstructPinginPubSubResp(const PikaCmdArgsType &argv) {
  + if (argv.size() > 2) {
  + return "-ERR wrong number of arguments for " + kCmdNamePing +
  + " command\r\n";
  + }
  + std::stringstream resp;
  +
  + resp << "*2\r\n"
  + << "$4\r\n"
  + << "pong\r\n";
  + if (argv.size() == 2) {
  + resp << "$" << argv[1].size() << "\r\n" << argv[1] << "\r\n";
  + } else {
  + resp << "$0\r\n\r\n";
  + }
  + return resp.str();
  +}
  +
  PikaClientConn::PikaClientConn(int fd, std::string ip_port,
  pink::Thread* thread,
  pink::PinkEpoll* pink_epoll,
  @@ -147,7 +165,7 @@ std::string PikaClientConn::DoCmd(const PikaCmdArgsType& argv,
  if (opt == kCmdNamePSubscribe || opt == kCmdNameSubscribe) { // PSubscribe or Subscribe
  std::shared_ptr<PinkConn> conn = std::dynamic_pointer_cast<PikaClientConn>(shared_from_this());
  if (!this->IsPubSub()) {
  - conn = server_thread_->MoveConnOut(fd());
  + server_thread_->MoveConnOut(fd());
  }
  std::vector<std::string > channels;
  for (size_t i = 1; i < argv.size(); i++) {
  @@ -177,6 +195,10 @@ std::string PikaClientConn::DoCmd(const PikaCmdArgsType& argv,
  return ConstructPubSubResp(opt, result);
  }
  + if (this->IsPubSub() && opt == kCmdNamePing) {
  + return ConstructPinginPubSubResp(argv);
  + }
  +
  if (!g_pika_server->IsCommandSupport(opt)) {
  return "-ERR This command only support in classic mode\r\n";
  }
  