MCPcopy Create free account
hub / github.com/apache/brpc / Run

Method Run

test/brpc_redis_unittest.cpp:913–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911 : _rs(rs) {}
912
913 brpc::RedisCommandHandlerResult Run(brpc::RedisConnContext* ctx,
914 const std::vector<butil::StringPiece>& args,
915 brpc::RedisReply* output,
916 bool flush_batched) {
917 if (args.size() < 1) {
918 output->SetError("ERR wrong number of arguments for 'AUTH' command");
919 return brpc::REDIS_CMD_HANDLED;
920 }
921 const std::string password(args[1].data(), args[1].size());
922 if (_rs->_password != password) {
923 output->SetError("ERR invalid username/password");
924 return brpc::REDIS_CMD_HANDLED;
925 }
926 auto auth_session = new AuthSession(password);
927 ctx->reset_session(auth_session);
928 output->SetStatus("OK");
929 return brpc::REDIS_CMD_HANDLED;
930 }
931
932private:
933 RedisServiceImpl* _rs;

Callers

nothing calls this directly

Calls 5

reset_sessionMethod · 0.80
SetStatusMethod · 0.80
sizeMethod · 0.45
SetErrorMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected