Commit 8c1f531f authored by zhujiashun's avatar zhujiashun

redis_server_protocol: refine code

parent d7826178
...@@ -81,7 +81,7 @@ void ConsumeTask(QueueMeta* meta, const RedisMessage& m, butil::Arena* arena, bu ...@@ -81,7 +81,7 @@ void ConsumeTask(QueueMeta* meta, const RedisMessage& m, butil::Arena* arena, bu
char buf[64]; char buf[64];
do { do {
std::vector<const char*> args; std::vector<const char*> args;
args.reserve(7); args.reserve(8);
bool args_parsed = true; bool args_parsed = true;
for (size_t i = 0; i < m.size(); ++i) { for (size_t i = 0; i < m.size(); ++i) {
if (!m[i].is_string()) { if (!m[i].is_string()) {
...@@ -125,11 +125,14 @@ void ConsumeTask(QueueMeta* meta, const RedisMessage& m, butil::Arena* arena, bu ...@@ -125,11 +125,14 @@ void ConsumeTask(QueueMeta* meta, const RedisMessage& m, butil::Arena* arena, bu
sendbuf->append(nocountbuf); sendbuf->append(nocountbuf);
return; return;
} else if (result == REDIS_COMMAND_ERROR) { } else if (result == REDIS_COMMAND_ERROR) {
meta->handler_continue = NULL;
meta->queue_command_name.clear();
if (!output.is_error()) { if (!output.is_error()) {
output.set_error("internal server error", arena); output.set_error("internal server error", arena);
} }
} else { } else {
meta->handler_continue = NULL; meta->handler_continue = NULL;
meta->queue_command_name.clear();
LOG(ERROR) << "unknown redis command result=" << result; LOG(ERROR) << "unknown redis command result=" << result;
output.set_error("internal server error", arena); output.set_error("internal server error", arena);
} }
......
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
// Returns PARSE_ERROR_ABSOLUTELY_WRONG if the parsing failed. // Returns PARSE_ERROR_ABSOLUTELY_WRONG if the parsing failed.
ParseError ConsumePartialIOBuf(butil::IOBuf& buf, butil::Arena* arena); ParseError ConsumePartialIOBuf(butil::IOBuf& buf, butil::Arena* arena);
// // Serialize to buf using redis protocol
bool SerializeToIOBuf(butil::IOBuf* buf); bool SerializeToIOBuf(butil::IOBuf* buf);
// Swap internal fields with another reply. // Swap internal fields with another reply.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment