Add HIDECONNECTION command.

This commit is contained in:
Yossi Gottlieb
2012-12-20 22:48:56 +02:00
parent cd0d292721
commit a3435e8f07
3 changed files with 15 additions and 2 deletions
+3
View File
@@ -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
------------------
+10 -2
View File
@@ -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
+2
View File
@@ -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);