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
97fde2e1
Commit
97fde2e1
authored
Nov 21, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redis_server_protocol: refine code
parent
bd7522b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
redis_protocol.cpp
src/brpc/policy/redis_protocol.cpp
+0
-1
redis_protocol.h
src/brpc/policy/redis_protocol.h
+1
-1
redis_message.h
src/brpc/redis_message.h
+1
-1
server.cpp
src/brpc/server.cpp
+11
-2
No files found.
src/brpc/policy/redis_protocol.cpp
View file @
97fde2e1
...
...
@@ -107,7 +107,6 @@ public:
bthread
::
ExecutionQueueId
<
ExecutionQueueContext
*>
queue
;
};
// "Message" = "Response" as we only implement the client for redis.
ParseResult
ParseRedisMessage
(
butil
::
IOBuf
*
source
,
Socket
*
socket
,
bool
read_eof
,
const
void
*
arg
)
{
if
(
read_eof
||
source
->
empty
())
{
...
...
src/brpc/policy/redis_protocol.h
View file @
97fde2e1
...
...
@@ -35,7 +35,7 @@ void ProcessRedisResponse(InputMessageBase* msg);
// Actions to a redis request, which is left unimplemented.
// All requests are processed in execution queue pushed in
// the pars
e
process.
// the pars
ing
process.
void
ProcessRedisRequest
(
InputMessageBase
*
msg
);
// Serialize a redis request.
...
...
src/brpc/redis_message.h
View file @
97fde2e1
...
...
@@ -162,7 +162,7 @@ inline RedisMessage::RedisMessage()
inline
bool
RedisMessage
::
is_nil
()
const
{
return
(
_type
==
REDIS_MESSAGE_NIL
)
||
((
_type
==
REDIS_MESSAGE_STRING
||
_type
==
REDIS_MESSAGE_ARRAY
)
&&
_length
==
uint32_t
(
-
1
)
);
_length
==
npos
);
}
inline
bool
RedisMessage
::
is_error
()
const
{
return
_type
==
REDIS_MESSAGE_ERROR
;
}
inline
bool
RedisMessage
::
is_integer
()
const
{
return
_type
==
REDIS_MESSAGE_INTEGER
;
}
...
...
src/brpc/server.cpp
View file @
97fde2e1
...
...
@@ -142,7 +142,8 @@ ServerOptions::ServerOptions()
,
has_builtin_services
(
true
)
,
http_master_service
(
NULL
)
,
health_reporter
(
NULL
)
,
rtmp_service
(
NULL
)
{
,
rtmp_service
(
NULL
)
,
redis_service
(
NULL
)
{
if
(
s_ncore
>
0
)
{
num_threads
=
s_ncore
+
1
;
}
...
...
@@ -1588,7 +1589,8 @@ void Server::GenerateVersionIfNeeded() {
if
(
!
_version
.
empty
())
{
return
;
}
int
extra_count
=
!!
_options
.
nshead_service
+
!!
_options
.
rtmp_service
+
!!
_options
.
thrift_service
;
int
extra_count
=
!!
_options
.
nshead_service
+
!!
_options
.
rtmp_service
+
!!
_options
.
thrift_service
+
!!
_options
.
redis_service
;
_version
.
reserve
((
extra_count
+
service_count
())
*
20
);
for
(
ServiceMap
::
const_iterator
it
=
_fullname_service_map
.
begin
();
it
!=
_fullname_service_map
.
end
();
++
it
)
{
...
...
@@ -1621,6 +1623,13 @@ void Server::GenerateVersionIfNeeded() {
}
_version
.
append
(
butil
::
class_name_str
(
*
_options
.
rtmp_service
));
}
if
(
_options
.
redis_service
)
{
if
(
!
_version
.
empty
())
{
_version
.
push_back
(
'+'
);
}
_version
.
append
(
butil
::
class_name_str
(
*
_options
.
redis_service
));
}
}
static
std
::
string
ExpandPath
(
const
std
::
string
&
path
)
{
...
...
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