projects
/
redis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test "Turning off AOF kills the background writing child if any" is now more reliable.
[redis.git]
/
src
/
pubsub.c
diff --git
a/src/pubsub.c
b/src/pubsub.c
index 23b0ceb0bcece1db097828047f19f680133c40f5..4e07dbbab1b296537e1ca4b0e2534a322f57fa20 100644
(file)
--- a/
src/pubsub.c
+++ b/
src/pubsub.c
@@
-36,12
+36,12
@@
int pubsubSubscribeChannel(redisClient *c, robj *channel) {
dictAdd(server.pubsub_channels,channel,clients);
incrRefCount(channel);
} else {
dictAdd(server.pubsub_channels,channel,clients);
incrRefCount(channel);
} else {
- clients = dictGet
Entry
Val(de);
+ clients = dictGetVal(de);
}
listAddNodeTail(clients,c);
}
/* Notify the client */
}
listAddNodeTail(clients,c);
}
/* Notify the client */
- addReply(c,shared.mbulk
3
);
+ addReply(c,shared.mbulk
hdr[3]
);
addReply(c,shared.subscribebulk);
addReplyBulk(c,channel);
addReplyLongLong(c,dictSize(c->pubsub_channels)+listLength(c->pubsub_patterns));
addReply(c,shared.subscribebulk);
addReplyBulk(c,channel);
addReplyLongLong(c,dictSize(c->pubsub_channels)+listLength(c->pubsub_patterns));
@@
-63,10
+63,10
@@
int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
retval = 1;
/* Remove the client from the channel -> clients list hash table */
de = dictFind(server.pubsub_channels,channel);
retval = 1;
/* Remove the client from the channel -> clients list hash table */
de = dictFind(server.pubsub_channels,channel);
- redisAssert
(
de != NULL);
- clients = dictGet
Entry
Val(de);
+ redisAssert
WithInfo(c,NULL,
de != NULL);
+ clients = dictGetVal(de);
ln = listSearchKey(clients,c);
ln = listSearchKey(clients,c);
- redisAssert
(
ln != NULL);
+ redisAssert
WithInfo(c,NULL,
ln != NULL);
listDelNode(clients,ln);
if (listLength(clients) == 0) {
/* Free the list and associated hash entry at all if this was
listDelNode(clients,ln);
if (listLength(clients) == 0) {
/* Free the list and associated hash entry at all if this was
@@
-77,7
+77,7
@@
int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
}
/* Notify the client */
if (notify) {
}
/* Notify the client */
if (notify) {
- addReply(c,shared.mbulk
3
);
+ addReply(c,shared.mbulk
hdr[3]
);
addReply(c,shared.unsubscribebulk);
addReplyBulk(c,channel);
addReplyLongLong(c,dictSize(c->pubsub_channels)+
addReply(c,shared.unsubscribebulk);
addReplyBulk(c,channel);
addReplyLongLong(c,dictSize(c->pubsub_channels)+
@@
-103,7
+103,7
@@
int pubsubSubscribePattern(redisClient *c, robj *pattern) {
listAddNodeTail(server.pubsub_patterns,pat);
}
/* Notify the client */
listAddNodeTail(server.pubsub_patterns,pat);
}
/* Notify the client */
- addReply(c,shared.mbulk
3
);
+ addReply(c,shared.mbulk
hdr[3]
);
addReply(c,shared.psubscribebulk);
addReplyBulk(c,pattern);
addReplyLongLong(c,dictSize(c->pubsub_channels)+listLength(c->pubsub_patterns));
addReply(c,shared.psubscribebulk);
addReplyBulk(c,pattern);
addReplyLongLong(c,dictSize(c->pubsub_channels)+listLength(c->pubsub_patterns));
@@
-128,7
+128,7
@@
int pubsubUnsubscribePattern(redisClient *c, robj *pattern, int notify) {
}
/* Notify the client */
if (notify) {
}
/* Notify the client */
if (notify) {
- addReply(c,shared.mbulk
3
);
+ addReply(c,shared.mbulk
hdr[3]
);
addReply(c,shared.punsubscribebulk);
addReplyBulk(c,pattern);
addReplyLongLong(c,dictSize(c->pubsub_channels)+
addReply(c,shared.punsubscribebulk);
addReplyBulk(c,pattern);
addReplyLongLong(c,dictSize(c->pubsub_channels)+
@@
-141,12
+141,12
@@
int pubsubUnsubscribePattern(redisClient *c, robj *pattern, int notify) {
/* Unsubscribe from all the channels. Return the number of channels the
* client was subscribed from. */
int pubsubUnsubscribeAllChannels(redisClient *c, int notify) {
/* Unsubscribe from all the channels. Return the number of channels the
* client was subscribed from. */
int pubsubUnsubscribeAllChannels(redisClient *c, int notify) {
- dictIterator *di = dictGetIterator(c->pubsub_channels);
+ dictIterator *di = dictGet
Safe
Iterator(c->pubsub_channels);
dictEntry *de;
int count = 0;
while((de = dictNext(di)) != NULL) {
dictEntry *de;
int count = 0;
while((de = dictNext(di)) != NULL) {
- robj *channel = dictGet
Entry
Key(de);
+ robj *channel = dictGetKey(de);
count += pubsubUnsubscribeChannel(c,channel,notify);
}
count += pubsubUnsubscribeChannel(c,channel,notify);
}
@@
-180,7
+180,7
@@
int pubsubPublishMessage(robj *channel, robj *message) {
/* Send to clients listening for that channel */
de = dictFind(server.pubsub_channels,channel);
if (de) {
/* Send to clients listening for that channel */
de = dictFind(server.pubsub_channels,channel);
if (de) {
- list *list = dictGet
Entry
Val(de);
+ list *list = dictGetVal(de);
listNode *ln;
listIter li;
listNode *ln;
listIter li;
@@
-188,7
+188,7
@@
int pubsubPublishMessage(robj *channel, robj *message) {
while ((ln = listNext(&li)) != NULL) {
redisClient *c = ln->value;
while ((ln = listNext(&li)) != NULL) {
redisClient *c = ln->value;
- addReply(c,shared.mbulk
3
);
+ addReply(c,shared.mbulk
hdr[3]
);
addReply(c,shared.messagebulk);
addReplyBulk(c,channel);
addReplyBulk(c,message);
addReply(c,shared.messagebulk);
addReplyBulk(c,channel);
addReplyBulk(c,message);
@@
-206,7
+206,7
@@
int pubsubPublishMessage(robj *channel, robj *message) {
sdslen(pat->pattern->ptr),
(char*)channel->ptr,
sdslen(channel->ptr),0)) {
sdslen(pat->pattern->ptr),
(char*)channel->ptr,
sdslen(channel->ptr),0)) {
- addReply(pat->client,shared.mbulk
4
);
+ addReply(pat->client,shared.mbulk
hdr[4]
);
addReply(pat->client,shared.pmessagebulk);
addReplyBulk(pat->client,pat->pattern);
addReplyBulk(pat->client,channel);
addReply(pat->client,shared.pmessagebulk);
addReplyBulk(pat->client,pat->pattern);
addReplyBulk(pat->client,channel);
@@
-262,7
+262,6
@@
void punsubscribeCommand(redisClient *c) {
}
void publishCommand(redisClient *c) {
}
void publishCommand(redisClient *c) {
- c->argv[2] = tryObjectEncoding(c->argv[2]);
int receivers = pubsubPublishMessage(c->argv[1],c->argv[2]);
addReplyLongLong(c,receivers);
}
int receivers = pubsubPublishMessage(c->argv[1],c->argv[2]);
addReplyLongLong(c,receivers);
}