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
ee1ed720
Commit
ee1ed720
authored
Jun 08, 2020
by
liuminghang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use string in AddCommandHandler
parent
8c5de009
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
redis.cpp
src/brpc/redis.cpp
+2
-3
redis.h
src/brpc/redis.h
+1
-1
redis_command.cpp
src/brpc/redis_command.cpp
+1
-1
No files found.
src/brpc/redis.cpp
View file @
ee1ed720
...
...
@@ -436,9 +436,8 @@ std::ostream& operator<<(std::ostream& os, const RedisResponse& response) {
return
os
;
}
bool
RedisService
::
AddCommandHandler
(
const
butil
::
StringPiece
&
name
,
RedisCommandHandler
*
handler
)
{
std
::
string
lcname
=
StringToLowerASCII
(
name
.
as_string
());
bool
RedisService
::
AddCommandHandler
(
const
std
::
string
&
name
,
RedisCommandHandler
*
handler
)
{
std
::
string
lcname
=
StringToLowerASCII
(
name
);
auto
it
=
_command_map
.
find
(
lcname
);
if
(
it
!=
_command_map
.
end
())
{
LOG
(
ERROR
)
<<
"redis command name="
<<
name
<<
" exist"
;
...
...
src/brpc/redis.h
View file @
ee1ed720
...
...
@@ -222,7 +222,7 @@ public:
virtual
~
RedisService
()
{}
// Call this function to register `handler` that can handle command `name`.
bool
AddCommandHandler
(
const
butil
::
StringPiece
&
name
,
RedisCommandHandler
*
handler
);
bool
AddCommandHandler
(
const
std
::
string
&
name
,
RedisCommandHandler
*
handler
);
// This function should not be touched by user and used by brpc deverloper only.
RedisCommandHandler
*
FindCommandHandler
(
const
butil
::
StringPiece
&
name
)
const
;
...
...
src/brpc/redis_command.cpp
View file @
ee1ed720
...
...
@@ -420,7 +420,7 @@ ParseError RedisCommandParser::Consume(butil::IOBuf& buf,
char
*
d
=
(
char
*
)
arena
->
allocate
((
len
/
8
+
1
)
*
8
);
buf
.
cutn
(
d
,
len
);
d
[
len
]
=
'\0'
;
_args
[
_index
]
=
butil
::
StringPiece
(
d
,
len
);
_args
[
_index
]
.
set
(
d
,
len
);
if
(
_index
==
0
)
{
// convert it to lowercase when it is command name
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
...
...
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