diff options
author | Mark Nunberg <mnunberg@haskalah.org> | 2019-02-21 11:49:25 -0500 |
---|---|---|
committer | Mark Nunberg <mnunberg@haskalah.org> | 2019-02-21 11:49:25 -0500 |
commit | 5eb6958870b71d30e3ed63e65e9f1d546dc419ec (patch) | |
tree | e2ac8ce65fa180fd28c1177089e450e3554ea868 /async.c | |
parent | 1ec4aefba6d3690c461ea870eab0984a2cb597f0 (diff) |
Allow option for async connections to not automatically free
Diffstat (limited to 'async.c')
-rw-r--r-- | async.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -361,7 +361,9 @@ static void __redisAsyncDisconnect(redisAsyncContext *ac) { /* For non-clean disconnects, __redisAsyncFree() will execute pending * callbacks with a NULL-reply. */ - __redisAsyncFree(ac); + if (!(c->flags & REDIS_NO_AUTO_FREE)) { + __redisAsyncFree(ac); + } } /* Tries to do a clean disconnect from Redis, meaning it stops new commands @@ -373,6 +375,9 @@ static void __redisAsyncDisconnect(redisAsyncContext *ac) { void redisAsyncDisconnect(redisAsyncContext *ac) { redisContext *c = &(ac->c); c->flags |= REDIS_DISCONNECTING; + + /** unset the auto-free flag here, because disconnect undoes this */ + c->flags &= ~REDIS_NO_AUTO_FREE; if (!(c->flags & REDIS_IN_CALLBACK) && ac->replies.head == NULL) __redisAsyncDisconnect(ac); } |