Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0ee1a78c
Commit
0ee1a78c
authored
Feb 10, 2014
by
antirez
Browse files
Cluster: added signature + version in bus packets.
parent
ff6a75a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
0ee1a78c
...
...
@@ -1166,7 +1166,9 @@ int clusterProcessPacket(clusterLink *link) {
type
,
(
unsigned
long
)
totlen
);
/* Perform sanity checks */
if
(
totlen
<
8
)
return
1
;
if
(
totlen
<
16
)
return
1
;
/* At least signature, totlen, count. */
if
(
hdr
->
sig
[
0
]
!=
'R'
||
hdr
->
sig
[
1
]
!=
'C'
||
hdr
->
sig
[
2
]
!=
'i'
||
hdr
->
sig
[
3
]
!=
'b'
)
return
1
;
/* Bad signature. */
if
(
totlen
>
sdslen
(
link
->
rcvbuf
))
return
1
;
if
(
type
==
CLUSTERMSG_TYPE_PING
||
type
==
CLUSTERMSG_TYPE_PONG
||
type
==
CLUSTERMSG_TYPE_MEET
)
...
...
@@ -1677,6 +1679,10 @@ void clusterBuildMessageHdr(clusterMsg *hdr, int type) {
myself
->
slaveof
:
myself
;
memset
(
hdr
,
0
,
sizeof
(
*
hdr
));
hdr
->
sig
[
0
]
=
'R'
;
hdr
->
sig
[
1
]
=
'C'
;
hdr
->
sig
[
2
]
=
'i'
;
hdr
->
sig
[
3
]
=
'b'
;
hdr
->
type
=
htons
(
type
);
memcpy
(
hdr
->
sender
,
myself
->
name
,
REDIS_CLUSTER_NAMELEN
);
...
...
src/cluster.h
View file @
0ee1a78c
...
...
@@ -195,6 +195,9 @@ union clusterMsgData {
typedef
struct
{
char
sig
[
4
];
/* Siganture "RCib" (Redis Cluster internal bus). */
uint16_t
ver
;
/* Protocol version, currently set to 0. */
uint16_t
notused0
;
/* 2 bytes not used. */
uint32_t
totlen
;
/* Total length of this message */
uint16_t
type
;
/* Message type */
uint16_t
count
;
/* Only used for some kind of messages. */
...
...
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