diff options
-rw-r--r-- | cluster_library.c | 13 | ||||
-rw-r--r-- | cluster_library.h | 2 | ||||
-rw-r--r-- | redis_cluster.c | 13 | ||||
-rw-r--r-- | redis_cluster.h | 9 |
4 files changed, 16 insertions, 21 deletions
diff --git a/cluster_library.c b/cluster_library.c index 7ebf7801..666234cb 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1784,16 +1784,15 @@ PHPAPI void cluster_mset_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, /* Raw MULTI BULK reply */ PHPAPI void -cluster_mbulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, - void *ctx) { +cluster_mbulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) +{ cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, mbulk_resp_loop_raw, NULL); } /* Unserialize all the things */ PHPAPI void -cluster_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, - void *ctx) +cluster_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) { cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, mbulk_resp_loop, NULL); @@ -1803,7 +1802,8 @@ cluster_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, * we will turn into key => value, key => value. */ PHPAPI void cluster_mbulk_zipstr_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, - void *ctx) { + void *ctx) +{ cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, mbulk_resp_loop_zipstr, NULL); } @@ -1811,7 +1811,8 @@ cluster_mbulk_zipstr_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, /* Handling key,value to key=>value where the values are doubles */ PHPAPI void cluster_mbulk_zipdbl_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, - void *ctx) { + void *ctx) +{ cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, mbulk_resp_loop_zipdbl, NULL); } diff --git a/cluster_library.h b/cluster_library.h index 61b73746..7d20f3e2 100644 --- a/cluster_library.h +++ b/cluster_library.h @@ -197,7 +197,7 @@ typedef struct redisClusterNode { HashTable *slaves; } redisClusterNode; -/* Forward decl */ +/* Forward declarations */ typedef struct clusterFoldItem clusterFoldItem; /* RedisCluster implementation structure */ diff --git a/redis_cluster.c b/redis_cluster.c index d540e5c2..c62e4dc6 100644 --- a/redis_cluster.c +++ b/redis_cluster.c @@ -379,7 +379,6 @@ distcmd_resp_handler(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, short slot, cb(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, (void*)ctx); } else { CLUSTER_ENQUEUE_RESPONSE(c, slot, cb, ctx); - RETVAL_ZVAL(getThis(), 1, 0); } // Clear out our command but retain allocated memory @@ -472,7 +471,7 @@ static int get_key_ht(redisCluster *c, HashTable *ht, HashPosition *ptr, /* Handler for both MGET and DEL */ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len, - zval *z_ret, cluster_cb cb) + zval *z_ret, cluster_cb cb) { redisCluster *c = GET_CONTEXT(); clusterMultiCmd mc = {0}; @@ -547,8 +546,8 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len, // If we've got straggler(s) process them if(mc.argc > 0) { - if(distcmd_resp_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, slot, &mc, - z_ret, 1, cb)<0) + if(distcmd_resp_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, slot, + &mc, z_ret, 1, cb)<0) { cluster_multi_free(&mc); return -1; @@ -558,6 +557,9 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len, // Free our command cluster_multi_free(&mc); + if(!CLUSTER_IS_ATOMIC(c)) + RETVAL_ZVAL(getThis(), 1, 0); + // Success return 0; } @@ -1705,7 +1707,8 @@ PHP_METHOD(RedisCluster, exec) { // MULTI multi-bulk response handler cluster_multi_mbulk_resp(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, NULL); - // Free our queue, and reset MULTI state + // Free our callback queue, any enqueued distributed command context items + // and reset our MULTI state. CLUSTER_FREE_QUEUE(c); CLUSTER_RESET_MULTI(c); } diff --git a/redis_cluster.h b/redis_cluster.h index e4fa9523..45bc288b 100644 --- a/redis_cluster.h +++ b/redis_cluster.h @@ -40,15 +40,6 @@ clusterFoldItem *_item = c->multi_head, *_tmp; \ while(_item) { \ _tmp = _item->next; \ - if(_item->ctx) { \ - zval **z_arr = (zval**)_item->ctx; int i=0; \ - while(z_arr[i]!=NULL) { \ - zval_dtor(z_arr[i]); \ - efree(z_arr[i]); \ - i++; \ - } \ - efree(z_arr); \ - } \ efree(_item); \ _item = _tmp; \ } \ |