Commit 06b3dced authored by antirez's avatar antirez
Browse files

asyncCloseClientOnOutputBufferLimitReached() now ignores clients with...

asyncCloseClientOnOutputBufferLimitReached() now ignores clients with REDIS_CLOSE_ASAP flag already set. Return value of the function changed from int to void since it is not used. Fixed logging of the client scheduled to be closed.
parent 51669c5a
...@@ -1266,21 +1266,19 @@ int checkClientOutputBufferLimits(redisClient *c) { ...@@ -1266,21 +1266,19 @@ int checkClientOutputBufferLimits(redisClient *c) {
} }
/* Asynchronously close a client if soft or hard limit is reached on the /* Asynchronously close a client if soft or hard limit is reached on the
* output buffer size. If the client will be closed 1 is returend, otherwise 0 * output buffer size. The caller can check if the client will be closed
* is returned. * checking if the client REDIS_CLOSE_ASAP flag is set.
* *
* Note: we need to close the client asynchronously because this function is * Note: we need to close the client asynchronously because this function is
* called from contexts where the client can't be freed safely, i.e. from the * called from contexts where the client can't be freed safely, i.e. from the
* lower level functions pushing data inside the client output buffers. */ * lower level functions pushing data inside the client output buffers. */
int asyncCloseClientOnOutputBufferLimitReached(redisClient *c) { void asyncCloseClientOnOutputBufferLimitReached(redisClient *c) {
if (c->flags & REDIS_CLOSE_ASAP) return;
if (checkClientOutputBufferLimits(c)) { if (checkClientOutputBufferLimits(c)) {
sds client = getClientInfoString(c); sds client = getClientInfoString(c);
freeClientAsync(c); freeClientAsync(c);
redisLog(REDIS_NOTICE,"Client %s scheduled to be closed ASAP for overcoming of output buffer limits."); redisLog(REDIS_NOTICE,"Client %s scheduled to be closed ASAP for overcoming of output buffer limits.", client);
sdsfree(client); sdsfree(client);
return 1;
} else {
return 0;
} }
} }
...@@ -804,7 +804,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...); ...@@ -804,7 +804,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...);
void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); void rewriteClientCommandArgument(redisClient *c, int i, robj *newval);
unsigned long getClientOutputBufferMemoryUsage(redisClient *c); unsigned long getClientOutputBufferMemoryUsage(redisClient *c);
void freeClientsInAsyncFreeQueue(void); void freeClientsInAsyncFreeQueue(void);
int asyncCloseClientOnOutputBufferLimitReached(redisClient *c); void asyncCloseClientOnOutputBufferLimitReached(redisClient *c);
#ifdef __GNUC__ #ifdef __GNUC__
void addReplyErrorFormat(redisClient *c, const char *fmt, ...) void addReplyErrorFormat(redisClient *c, const char *fmt, ...)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment