mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
SCAN: when iterating ziplists or intsets always return cursor of 0.
The previous implementation assumed that the first call always happens with cursor set to 0, this may not be the case, and we want to return 0 anyway otherwise the (broken) client code will loop forever.
This commit is contained in:
parent
101d4bf867
commit
b4048dfec0
2
src/db.c
2
src/db.c
@ -462,6 +462,7 @@ void scanGenericCommand(redisClient *c, robj *o) {
|
||||
|
||||
while(intsetGet(o->ptr,pos++,&ll))
|
||||
listAddNodeTail(keys,createStringObjectFromLongLong(ll));
|
||||
cursor = 0;
|
||||
} else if (o->type == REDIS_HASH || o->type == REDIS_ZSET) {
|
||||
unsigned char *p = ziplistIndex(o->ptr,0);
|
||||
unsigned char *vstr;
|
||||
@ -475,6 +476,7 @@ void scanGenericCommand(redisClient *c, robj *o) {
|
||||
createStringObjectFromLongLong(vll));
|
||||
p = ziplistNext(o->ptr,p);
|
||||
}
|
||||
cursor = 0;
|
||||
} else {
|
||||
redisPanic("Not handled encoding in SCAN.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user