]> git.saurik.com Git - redis.git/blobdiff - src/pubsub.c
Remove the write handler only if there are no longer objects in the output queue...
[redis.git] / src / pubsub.c
index c9f5f310e55d1894430283017ff828cf240e014b..728e559c9e4c563067c5fd2ce8417fc9ec0b5061 100644 (file)
@@ -1,5 +1,9 @@
 #include "redis.h"
 
+/*-----------------------------------------------------------------------------
+ * Pubsub low level API
+ *----------------------------------------------------------------------------*/
+
 void freePubsubPattern(void *p) {
     pubsubPattern *pat = p;
 
@@ -137,7 +141,7 @@ 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) {
-    dictIterator *di = dictGetIterator(c->pubsub_channels);
+    dictIterator *di = dictGetSafeIterator(c->pubsub_channels);
     dictEntry *de;
     int count = 0;
 
@@ -215,6 +219,10 @@ int pubsubPublishMessage(robj *channel, robj *message) {
     return receivers;
 }
 
+/*-----------------------------------------------------------------------------
+ * Pubsub commands implementation
+ *----------------------------------------------------------------------------*/
+
 void subscribeCommand(redisClient *c) {
     int j;