Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
ad7081f8
Commit
ad7081f8
authored
5 years ago
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redis_server_protocol: refine code
parent
c7ba8c54
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
redis_protocol.cpp
src/brpc/policy/redis_protocol.cpp
+5
-7
redis_command.cpp
src/brpc/redis_command.cpp
+4
-0
No files found.
src/brpc/policy/redis_protocol.cpp
View file @
ad7081f8
...
...
@@ -107,8 +107,7 @@ int ConsumeCommand(RedisConnContext* ctx,
result
=
ch
->
Run
(
commands
,
&
output
,
is_last
);
if
(
result
==
RedisCommandHandler
::
CONTINUE
)
{
if
(
ctx
->
batched_size
!=
0
)
{
LOG
(
ERROR
)
<<
"Do you forget to return OK "
"when is_last is true?"
;
LOG
(
ERROR
)
<<
"Do you forget to return OK when is_last is true?"
;
return
-
1
;
}
ctx
->
transaction_handler
.
reset
(
ch
->
NewTransactionHandler
());
...
...
@@ -185,11 +184,10 @@ ParseResult ParseRedisMessage(butil::IOBuf* source, Socket* socket,
if
(
err
!=
PARSE_OK
)
{
break
;
}
std
::
string
next_command_name
;
if
(
!
next_commands
.
empty
())
{
next_command_name
=
next_commands
[
0
];
}
if
(
ConsumeCommand
(
ctx
,
current_commands
,
next_command_name
,
&
arena
,
false
,
&
sendbuf
)
!=
0
)
{
// next_commands must have at least one element, otherwise parse.Consume()
// should return error.
if
(
ConsumeCommand
(
ctx
,
current_commands
,
next_commands
[
0
],
&
arena
,
false
,
&
sendbuf
)
!=
0
)
{
return
MakeParseError
(
PARSE_ERROR_ABSOLUTELY_WRONG
);
}
current_commands
.
swap
(
next_commands
);
...
...
This diff is collapsed.
Click to expand it.
src/brpc/redis_command.cpp
View file @
ad7081f8
...
...
@@ -377,6 +377,10 @@ ParseError RedisCommandParser::Consume(butil::IOBuf& buf,
LOG
(
ERROR
)
<<
'`'
<<
intbuf
+
1
<<
"' is not a valid 64-bit decimal"
;
return
PARSE_ERROR_ABSOLUTELY_WRONG
;
}
if
(
value
<=
0
)
{
LOG
(
ERROR
)
<<
"Invalid len="
<<
value
<<
" in redis command"
;
return
PARSE_ERROR_ABSOLUTELY_WRONG
;
}
if
(
!
_parsing_array
)
{
buf
.
pop_front
(
crlf_pos
+
2
/*CRLF*/
);
_parsing_array
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment