diff --git a/src/networking.c b/src/networking.c index b8f338658dd4dda2c54ddf2e30bc09bcc9cf0cba..9490757279ab6aa9572b5ff81e95d77d87a5622c 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1266,21 +1266,19 @@ int checkClientOutputBufferLimits(redisClient *c) { } /* 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 - * is returned. + * output buffer size. The caller can check if the client will be closed + * checking if the client REDIS_CLOSE_ASAP flag is set. * * 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 * 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)) { sds client = getClientInfoString(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); - return 1; - } else { - return 0; } } diff --git a/src/redis.h b/src/redis.h index dbb56ca3e24c920208ce1f79a913bfae5334bf03..43c05b3af4d615dbc60298f75fd1a4b1548a0845 100644 --- a/src/redis.h +++ b/src/redis.h @@ -804,7 +804,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...); void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); unsigned long getClientOutputBufferMemoryUsage(redisClient *c); void freeClientsInAsyncFreeQueue(void); -int asyncCloseClientOnOutputBufferLimitReached(redisClient *c); +void asyncCloseClientOnOutputBufferLimitReached(redisClient *c); #ifdef __GNUC__ void addReplyErrorFormat(redisClient *c, const char *fmt, ...)