diff --git a/README.Garantia b/README.Garantia index f6e5c33e7..ec5522166 100644 --- a/README.Garantia +++ b/README.Garantia @@ -108,6 +108,9 @@ DRAIN in which it will not accept any command other than INFO, PING or DRAIN (which is expected to be used by the caller to poll the server state). +HIDECONNECTION + Flags the current client connection hidden, so that its commands will + not show up in MONITOR output. Build Tree Changes ------------------ diff --git a/src/redis.c b/src/redis.c index 56fed5722..6fe416fa1 100755 --- a/src/redis.c +++ b/src/redis.c @@ -253,7 +253,8 @@ struct redisCommand redisCommandTable[] = { {"script",scriptCommand,-2,"ras",0,NULL,0,0,0,0,0}, {"time",timeCommand,1,"rR",0,NULL,0,0,0,0,0}, {"bitop",bitopCommand,-4,"wm",0,NULL,2,-1,1,0,0}, - {"bitcount",bitcountCommand,-2,"r",0,NULL,1,1,1,0,0} + {"bitcount",bitcountCommand,-2,"r",0,NULL,1,1,1,0,0}, + {"hideconnection",hideconnectionCommand,1,"r",0,NULL,0,0,0,0,0} }; /*============================ Utility functions ============================ */ @@ -1526,7 +1527,8 @@ void call(redisClient *c, int flags) { /* Sent the command to clients in MONITOR mode, only if the commands are * not geneated from reading an AOF. */ - if (listLength(server.monitors) && + if (!(c->flags & REDIS_HIDDEN) && + listLength(server.monitors) && !server.loading && !(c->cmd->flags & REDIS_CMD_SKIP_MONITOR)) { @@ -2282,6 +2284,12 @@ void drainCommand(redisClient *c) { } } +void hideconnectionCommand(redisClient *c) { + c->flags |= REDIS_HIDDEN; + addReply(c, shared.ok); +} + + /* ============================ Maxmemory directive ======================== */ /* This function gets called when 'maxmemory' is set on the config file to limit diff --git a/src/redis.h b/src/redis.h index 433122094..56b08aa3a 100755 --- a/src/redis.h +++ b/src/redis.h @@ -184,6 +184,7 @@ #define REDIS_CLOSE_ASAP (1<<10)/* Close this client ASAP */ #define REDIS_UNIX_SOCKET (1<<11) /* Client connected via Unix domain socket */ #define REDIS_DIRTY_EXEC (1<<12) /* EXEC will fail for errors while queueing */ +#define REDIS_HIDDEN (1<<13) /* Client is hidden, won't show up in MONITOR */ /* Client request types */ #define REDIS_REQ_INLINE 1 @@ -1207,6 +1208,7 @@ void dumpCommand(redisClient *c); void objectCommand(redisClient *c); void clientCommand(redisClient *c); void drainCommand(redisClient *c); +void hideconnectionCommand(redisClient *c); void evalCommand(redisClient *c); void evalShaCommand(redisClient *c); void scriptCommand(redisClient *c);