mirror of
https://github.com/fluencelabs/redis
synced 2025-06-24 22:41:32 +00:00
Cluster: clusterMsgDataGossip structure, explict padding + minor stuff.
Also explicitly set version to 0, add a protocol version define, improve comments in the gossip structure. Note that the structure layout is the same after the change, we are just making the padding explicit with an additional not used 16 bits field. So this commit is still able to talk with the previous versions of cluster nodes.
This commit is contained in:
@ -1465,7 +1465,8 @@ int clusterProcessPacket(clusterLink *link) {
|
||||
|
||||
/* Perform sanity checks */
|
||||
if (totlen < 16) return 1; /* At least signature, version, totlen, count. */
|
||||
if (ntohs(hdr->ver) != 0) return 1; /* Can't handle versions other than 0.*/
|
||||
if (ntohs(hdr->ver) != CLUSTER_PROTO_VER)
|
||||
return 1; /* Can't handle versions other than the current one.*/
|
||||
if (totlen > sdslen(link->rcvbuf)) return 1;
|
||||
if (type == CLUSTERMSG_TYPE_PING || type == CLUSTERMSG_TYPE_PONG ||
|
||||
type == CLUSTERMSG_TYPE_MEET)
|
||||
@ -2027,6 +2028,7 @@ void clusterBuildMessageHdr(clusterMsg *hdr, int type) {
|
||||
myself->slaveof : myself;
|
||||
|
||||
memset(hdr,0,sizeof(*hdr));
|
||||
hdr->ver = htons(CLUSTER_PROTO_VER);
|
||||
hdr->sig[0] = 'R';
|
||||
hdr->sig[1] = 'C';
|
||||
hdr->sig[2] = 'm';
|
||||
|
Reference in New Issue
Block a user