mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Fix crash caused by pubsubShardUnsubscribeAllChannelsInSlot not deleting the client (#12896)
The code does not delete the corresponding node when traversing clients, resulting in a loop, causing the dictDelete() == DICT_OK assertion to fail. In addition, did a cleanup, in the dictCreate scenario, we can avoid a dictFind call since the dict is empty. Issue was introduced in #12804.
This commit is contained in:
parent
5b1fe925f2
commit
99c468c38c
@ -295,8 +295,10 @@ int pubsubSubscribeChannel(client *c, robj *channel, pubsubtype type) {
|
||||
d_ptr = type.serverPubSubChannels(slot);
|
||||
if (*d_ptr == NULL) {
|
||||
*d_ptr = dictCreate(&keylistDictType);
|
||||
de = NULL;
|
||||
} else {
|
||||
de = dictFind(*d_ptr, channel);
|
||||
}
|
||||
de = dictFind(*d_ptr, channel);
|
||||
if (de == NULL) {
|
||||
clients = listCreate();
|
||||
dictAdd(*d_ptr, channel, clients);
|
||||
@ -387,6 +389,7 @@ void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot) {
|
||||
if (clientTotalPubSubSubscriptionCount(c) == 0) {
|
||||
unmarkClientAsPubSub(c);
|
||||
}
|
||||
listDelNode(clients, ln);
|
||||
}
|
||||
server.shard_channel_count--;
|
||||
dictDelete(d, channel);
|
||||
|
Loading…
Reference in New Issue
Block a user