diff options
author | Björn Svensson <bjorn.a.svensson@est.tech> | 2022-02-02 23:29:59 +0100 |
---|---|---|
committer | Björn Svensson <bjorn.a.svensson@est.tech> | 2022-02-03 09:26:01 +0100 |
commit | 7123b87f6d237e0ddf75c9698b2961e2d102a69d (patch) | |
tree | 066e4aaf23344cd85c25f7801384b2b30102e8eb /async.h | |
parent | b6fb548fc65497ce933cfd15b6fd91c700d4b34e (diff) |
Handle any pipelined unsubscribe in async
Redis responds to an unsubscribe with one or many replies, depending
on the current subscribe state. When channels/patterns names are
provided in a command each given name will trigger a reply even if
duplicated or not subscribed to.
To know when we can return from the subscribed state we need to do
bookkeeping on pending additional unsubscribe replies, and make sure
we receive them all before switching state.
Diffstat (limited to 'async.h')
-rw-r--r-- | async.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -46,6 +46,7 @@ typedef struct redisCallback { struct redisCallback *next; /* simple singly linked list */ redisCallbackFn *fn; int pending_subs; + int unsubscribe_sent; void *privdata; } redisCallback; @@ -105,6 +106,7 @@ typedef struct redisAsyncContext { redisCallbackList replies; struct dict *channels; struct dict *patterns; + int pending_unsubs; } sub; /* Any configured RESP3 PUSH handler */ |