| 990 | } |
| 991 | |
| 992 | void blmoveGenericCommand(client *c, int wherefrom, int whereto, mstime_t timeout) { |
| 993 | robj *key = lookupKeyWrite(c->db, c->argv[1]); |
| 994 | if (checkType(c,key,OBJ_LIST)) return; |
| 995 | |
| 996 | if (key == NULL) { |
| 997 | if (c->flags & CLIENT_DENY_BLOCKING) { |
| 998 | /* Blocking against an empty list when blocking is not allowed |
| 999 | * returns immediately. */ |
| 1000 | addReplyNull(c); |
| 1001 | } else { |
| 1002 | /* The list is empty and the client blocks. */ |
| 1003 | struct listPos pos = {wherefrom, whereto}; |
| 1004 | blockForKeys(c,BLOCKED_LIST,c->argv + 1,1,timeout,c->argv[2],&pos,NULL); |
| 1005 | } |
| 1006 | } else { |
| 1007 | /* The list exists and has elements, so |
| 1008 | * the regular lmoveCommand is executed. */ |
| 1009 | serverAssertWithInfo(c,key,listTypeLength(key) > 0); |
| 1010 | lmoveGenericCommand(c,wherefrom,whereto); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | /* BLMOVE <source> <destination> (LEFT|RIGHT) (LEFT|RIGHT) <timeout> */ |
| 1015 | void blmoveCommand(client *c) { |
no test coverage detected