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
07bce540
Commit
07bce540
authored
Nov 08, 2018
by
antirez
Browse files
RESP3: Use new deferred len API in replication.c.
parent
07329369
Changes
1
Show whitespace changes
Inline
Side-by-side
src/replication.c
View file @
07bce540
...
@@ -263,7 +263,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
...
@@ -263,7 +263,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
* or are already in sync with the master. */
* or are already in sync with the master. */
/* Add the multi bulk length. */
/* Add the multi bulk length. */
addReply
MultiBulk
Len(slave,argc);
addReply
Array
Len(slave,argc);
/* Finally any additional argument that was not stored inside the
/* Finally any additional argument that was not stored inside the
* static buffer if any (from j to argc). */
* static buffer if any (from j to argc). */
...
@@ -2062,10 +2062,10 @@ void roleCommand(client *c) {
...
@@ -2062,10 +2062,10 @@ void roleCommand(client *c) {
void *mbcount;
void *mbcount;
int slaves = 0;
int slaves = 0;
addReply
MultiBulk
Len(c,3);
addReply
Array
Len(c,3);
addReplyBulkCBuffer(c,"master",6);
addReplyBulkCBuffer(c,"master",6);
addReplyLongLong(c,server.master_repl_offset);
addReplyLongLong(c,server.master_repl_offset);
mbcount = addDeferred
MultiBulkLength
(c);
mbcount = add
Reply
Deferred
Len
(c);
listRewind(server.slaves,&li);
listRewind(server.slaves,&li);
while((ln = listNext(&li))) {
while((ln = listNext(&li))) {
client *slave = ln->value;
client *slave = ln->value;
...
@@ -2077,17 +2077,17 @@ void roleCommand(client *c) {
...
@@ -2077,17 +2077,17 @@ void roleCommand(client *c) {
slaveip = ip;
slaveip = ip;
}
}
if (slave->replstate != SLAVE_STATE_ONLINE) continue;
if (slave->replstate != SLAVE_STATE_ONLINE) continue;
addReply
MultiBulk
Len(c,3);
addReply
Array
Len(c,3);
addReplyBulkCString(c,slaveip);
addReplyBulkCString(c,slaveip);
addReplyBulkLongLong(c,slave->slave_listening_port);
addReplyBulkLongLong(c,slave->slave_listening_port);
addReplyBulkLongLong(c,slave->repl_ack_off);
addReplyBulkLongLong(c,slave->repl_ack_off);
slaves++;
slaves++;
}
}
setDeferred
MultiBulkLength
(c,mbcount,slaves);
setDeferred
ArrayLen
(c,mbcount,slaves);
} else {
} else {
char *slavestate = NULL;
char *slavestate = NULL;
addReply
MultiBulk
Len(c,5);
addReply
Array
Len(c,5);
addReplyBulkCBuffer(c,"slave",5);
addReplyBulkCBuffer(c,"slave",5);
addReplyBulkCString(c,server.masterhost);
addReplyBulkCString(c,server.masterhost);
addReplyLongLong(c,server.masterport);
addReplyLongLong(c,server.masterport);
...
@@ -2116,7 +2116,7 @@ void replicationSendAck(void) {
...
@@ -2116,7 +2116,7 @@ void replicationSendAck(void) {
if (c != NULL) {
if (c != NULL) {
c->flags |= CLIENT_MASTER_FORCE_REPLY;
c->flags |= CLIENT_MASTER_FORCE_REPLY;
addReply
MultiBulk
Len(c,3);
addReply
Array
Len(c,3);
addReplyBulkCString(c,"REPLCONF");
addReplyBulkCString(c,"REPLCONF");
addReplyBulkCString(c,"ACK");
addReplyBulkCString(c,"ACK");
addReplyBulkLongLong(c,c->reploff);
addReplyBulkLongLong(c,c->reploff);
...
...
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