PubSub clients refactoring and new PUBSUB flag.

The code tested many times if a client had active Pub/Sub subscriptions
by checking the length of a list and dictionary where the patterns and
channels are stored. This was substituted with a client flag called
REDIS_PUBSUB that is simpler to test for. Moreover in order to manage
this flag some code was refactored.

This commit is believed to have no effects in the behavior of the
server.
This commit is contained in:
antirez
2014-07-16 17:34:07 +02:00
parent c7822bf382
commit 59cf0824d9
4 changed files with 18 additions and 8 deletions

View File

@ -241,6 +241,7 @@ typedef long long mstime_t; /* millisecond time type. */
#define REDIS_FORCE_REPL (1<<15) /* Force replication of current cmd. */
#define REDIS_PRE_PSYNC (1<<16) /* Instance don't understand PSYNC. */
#define REDIS_READONLY (1<<17) /* Cluster client is in read-only state. */
#define REDIS_PUBSUB (1<<18) /* Client is in Pub/Sub mode. */
/* Client block type (btype field in client structure)
* if REDIS_BLOCKED flag is set. */