diff --git a/src/formats/json.c b/src/formats/json.c index 0cbcb527..e66cdd33 100644 --- a/src/formats/json.c +++ b/src/formats/json.c @@ -30,6 +30,11 @@ json_reply(redisAsyncContext *c, void *r, void *privdata) { return; } + if(c->c.flags & REDIS_DISCONNECTING) { + /* closing connection */ + return; + } + /* encode redis reply as JSON */ j = json_wrap_redis_reply(cmd, r); diff --git a/src/formats/raw.c b/src/formats/raw.c index 77005e6e..6b81cc8a 100644 --- a/src/formats/raw.c +++ b/src/formats/raw.c @@ -25,6 +25,11 @@ raw_reply(redisAsyncContext *c, void *r, void *privdata) { return; } + if(c->c.flags & REDIS_DISCONNECTING) { + /* closing connection */ + return; + } + raw_out = raw_wrap(r, &sz); /* send reply */