Skip to content

Commit

Permalink
modified the BRPOPLPUSH target field cleanup strategy to fix it the p…
Browse files Browse the repository at this point in the history
…roper way.
  • Loading branch information
antirez committed May 27, 2011
1 parent d7061f8 commit b190b0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/t_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
receiver = ln->value;
dstkey = receiver->bpop.target;

/* Protect receiver->bpop.target, that will be freed by
* the next unblockClientWaitingData() call. */
if (dstkey) incrRefCount(dstkey);
/* This should remove the first element of the "clients" list. */
unblockClientWaitingData(receiver);

Expand All @@ -877,13 +880,12 @@ int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
} else {
/* BRPOPLPUSH, note that receiver->db is always equal to c->db. */
dstobj = lookupKeyWrite(receiver->db,dstkey);
if (dstobj && checkType(receiver,dstobj,REDIS_LIST)) {
decrRefCount(dstkey);
} else {
if (!(dstobj && checkType(receiver,dstobj,REDIS_LIST))) {
rpoplpushHandlePush(c,receiver,dstkey,dstobj,ele);
decrRefCount(dstkey);
return 1;
}
decrRefCount(dstkey);
}
}

Expand Down

0 comments on commit b190b0c

Please sign in to comment.